Skip to content

Instantly share code, notes, and snippets.

@dlordi
Created September 19, 2019 12:02
Show Gist options
  • Save dlordi/6a803f081e0a13c0974a0190476f26eb to your computer and use it in GitHub Desktop.
Save dlordi/6a803f081e0a13c0974a0190476f26eb to your computer and use it in GitHub Desktop.
On Error Resume Next
Set shell = CreateObject("WScript.Shell")
randomguid="{9680a193-a38a-424b-a647-c620bb5a1fc0}"
shell.RegWrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\", ""
set svc=getobject("winmgmts:root\cimv2\")
sQuery="select * from win32_process where ProcessId=824 and Name='Uninstaller'"
set cproc=svc.execquery(sQuery)
Do While cproc.count > 0
shell.RegWrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\" & randomguid, Wscript.ScriptFullName, "REG_SZ"
wscript.sleep 1000
set cproc=svc.execquery(sQuery)
Loop
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("%HOME%\AppData\Local\Temp\{1FCE60B7-E501-45AA-BB6A-082870EB6D3E}")
folder.Delete True
Set script = fso.GetFile(Wscript.ScriptFullName)
script.Delete True
shell.RegDelete("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\" & randomguid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment