VBScript to automatically & silently remove ZenWorks regardless of version, with no hard manual labor

Novell ZenWorks Configuration ManagementVBScript to automatically remove ZenWorks regardless of version, with no user prompting or hard manual labor

Adding to my collection of VBScript tools for migrating from Novell to Microsoft, here is a little gem to removing ZenWorks, by reading the uninstall information on the computer, we find any version of ZenWorks and the command to uninstall it quietly and without any user prompts.

In a few situations the computer will fail to uninstall ZenWorks, the primary reason for me has been on a computer that is awaiting a reboot from a previous install or uninstall procedure. Simply rebooting the machine and running the script again seems to fix this problem. I have made a script to do that as well, but I dont want to overcomplicate things, and will just post the snippet of how to actually uninstall it here.

You should test this before using it in production, and always at own risk, dont forget to add error handling and logging as needed. Enjoy!

WordPress seems to mess with formating of ” and ‘ so if the script gives you errors on line 1, try fixing thoose or download a text version of the script here removezenworks2.vbs.txt

Script updated with corrections from Philip Damien-Grint, Thank you for sharing 🙂

' You may use this script and parts of it as you please, all that I ask is that you give a small thank you note on my blog www.sole.dk
' Enjoy and use at own risk!

On Error Resume Next ' We dont like users finding out we cant program!

Set objReg=GetObject("winmgmts:!root/default:StdRegProv") ' Registry access
Set WshShell = WScript.CreateObject("WScript.Shell") ' used For executing a command line command

' I would like to know what version of ZenWorks this is, only to find out if i uninstalled it successfully.
' You may remove this if you dont care

SubKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
ValueName = "DisplayVersion"
' This is all the GUID's I have found so far that is related to ZenWorks
' if you find a version, that is not in here, go to the location in registry you see in SubKey
' Go thru each GUID and find the one with ZenWorks, and add it below
' Also do write a comment with the GUID and version you found on www.sole.dk !
GUIDArray = Array(_
' Thank Anthon for the long list of GUIDs :)
' We search each guid to see if it exist and what displayversion it is
For Each GUID In GUIDArray
    objReg.GetStringValue HKLM, SubKey & GUID, ValueName, Value
    If Len(Value) > 2 Then
        WScript.Echo "ZenWorks GUID Found : " & GUID & " DisplayVersion = " & Value
        WshShell.Run "Taskkill.exe /f /im zenrem32.exe", 0, False ' Kill the ZenWorks mgt agent in case it hangs, so it wont block our uninstall, and we dont want to wait before continueing, so False.
        WshShell.Run "MsiExec.exe /x " & GUID & " REBOOT=ReallySuppress /qn", 0, True ' I dont want the uninstall to reboot or show anything to the user...
        WScript.Echo "Checking if uninstalled."
        objReg.GetStringValue HKLM, SubKey & GUID, ValueName, Value2
        If Value = Value2 Then
            WScript.Echo "UN-Successfull uninstall of ZenWorks Version: " & Value
            WScript.Echo "Successfull uninstall of ZenWorks Version: " & Value
        End If
    End If
Set objReg = Nothing
Set WshShell = Nothing

52 Responses to “VBScript to automatically & silently remove ZenWorks regardless of version, with no hard manual labor”

  • DougB:

    I found this little gem that uninstalls Zenworks (and any other app you don’t want). Cheers…

    $app = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -match “Zenworks” }

  • JacobP:

    You don’t want to use that WMI query to do this – it’ll cause a repair of any and all (including those that don’t match the query) and can break things.

Leave a Reply