Uninstall Spybot Unattended
Hello,
I am creating a package to uninstall Spybot unattended. I have several versions of spybot to remove off machines. When i run the script i get the Windows Installer pop up. Any help would be greatly appreciated.
This is my script.
Christa
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set WshShell = CreateObject("wscript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
strDisplayName = WshShell.RegRead ("HKLM\" & strKeyPath & "\" & subkey & "\DisplayName")
If strDisplayName = "Spybot - Search & Destroy" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.2" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.3" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.4" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.5.2.20" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.6.2" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
Next
I am creating a package to uninstall Spybot unattended. I have several versions of spybot to remove off machines. When i run the script i get the Windows Installer pop up. Any help would be greatly appreciated.
This is my script.
Christa
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set WshShell = CreateObject("wscript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
strDisplayName = WshShell.RegRead ("HKLM\" & strKeyPath & "\" & subkey & "\DisplayName")
If strDisplayName = "Spybot - Search & Destroy" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.2" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.3" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.4" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.5.2.20" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
If strDisplayName = "Spybot - Search & Destroy 1.6.2" Then
WshShell.Run "msiexec.exe /norestart /X " & SubKey & " /qn", 7, True
End If
Next
0 Comments
[ + ] Show comments
Answers (8)
Please log in to answer
Posted by:
anonymous_9363
13 years ago
Posted by:
clyrigham
13 years ago
Posted by:
anonymous_9363
13 years ago
You are getting the subkey name directly, maybe you need to take the UninstallString into this subkey... Perhaps the UninstallString is set to call a different productkey than the subkey or call a .exe to uninstall the package!The EXE note is a good call but, for MSIs, I defy you to find a sub-key whose name was not in the uninstall string: a ProductCode is a ProductCode is a ProductCode.
Posted by:
clyrigham
13 years ago
Ok, did you not get a package made/digged by another person who made a s**t in that? So, I did... to your surprise the productcode was different and it uninstalled 2 applications in one time!
Otherthing: this is a forum to help other people, not to show who knows more than another Sir.
-- No cursing please -Bob
Otherthing: this is a forum to help other people, not to show who knows more than another Sir.
-- No cursing please -Bob
Posted by:
anonymous_9363
13 years ago
First, let me deal with the ProductCode. Please explain how - exactly - the Windows Installer engine uninstalled the product with the incorrect ProductCode. The packed GUID which is used to match features and components to that product would not match up so nothing would get uninstalled. Indeed, I'd expect the engine to present the message "This action is only valid for installed products." when the uninstall was attempted.
Second, whilst I am generally scathing about vendor packages, I rather fancy that, given the above i.e. a product which can't be uninstalled, a vendor would hastily release a package with no such error. If you're talking about internal packages, well, the author hopefully wouldn't last long enough to release more than one such package.
Lastly, let me deal with your attitude. No, on second thoughts, I don't think I'll bother.
Second, whilst I am generally scathing about vendor packages, I rather fancy that, given the above i.e. a product which can't be uninstalled, a vendor would hastily release a package with no such error. If you're talking about internal packages, well, the author hopefully wouldn't last long enough to release more than one such package.
Lastly, let me deal with your attitude. No, on second thoughts, I don't think I'll bother.
Posted by:
clyrigham
13 years ago
Thanks for the explanation dude. But really I already knew about it
I know that package I mentioned in my last package was great error from the vendor (sorry if I do not remember what is the package, I think it was a internal software from a small company I worked, and I was responsable to replace that guy...)
When I wrote about the productcode may be different from the uninstallstring is because I lived this experience, sorry if I was stupid with you, but I was thinking your attitude to defy me was unnecessary. Sometimes in this forum I feel the members aren't friends to collaborate with others...
Stay in peace my friend!
Kind Regards,
I know that package I mentioned in my last package was great error from the vendor (sorry if I do not remember what is the package, I think it was a internal software from a small company I worked, and I was responsable to replace that guy...)
When I wrote about the productcode may be different from the uninstallstring is because I lived this experience, sorry if I was stupid with you, but I was thinking your attitude to defy me was unnecessary. Sometimes in this forum I feel the members aren't friends to collaborate with others...
Stay in peace my friend!
Kind Regards,
Posted by:
anonymous_9363
13 years ago

so that the conversation will remain readable.