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!

Const HKLM=&H80000002 'HKEY_LOCAL_MACHINE
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(_
"{076EF7C2-6F61-4753-BFC1-796E04C49CF7}",_
"{15A3C0D8-3D81-4CF6-8797-E27BDE5F8573}",_
"{166763F3-BAEB-433A-A834-1FD86E19B55D}",_
"{1717FEDC-6D5A-44B7-AB98-814834F0E695}",_
"{17C573A8-D916-4166-81A6-7C5C608919CA}",_
"{1AEEA8FF-AFF1-4BE6-A9DE-A2F10F69BA4E}",_
"{1BE23A18-1B51-4F59-8326-33CA5F1294F4}",_
"{1CA2B9F5-835B-46C2-8961-D52C96C613B7}",_
"{1CE5F3D4-CF76-453E-BDF7-98DFD2588B67}",_
"{27AAD3D9-92BA-459F-9A81-0B9DB195F801}",_
"{2CB10E96-23CD-4AE2-A7C4-9CF75463C174}",_
"{2FE4A854-6739-45B9-AF0B-270AA25215F4}",_
"{364DA896-84B4-4887-95AA-5A2953234217}",_
"{3C6849B6-1953-4DAF-9A8B-783FB72F3CBB}",_
"{446A6549-46F8-48C1-ABDE-564A91819F2C}",_
"{4CD57A44-0FE0-44B5-AC1A-BDE5490FEA6F}",_
"{4DF669B8-5B56-4174-AFDE-BE7DA0662850}",_
"{59227974-8DF9-4422-943A-C9740BE21D22}",_
"{595716AC-C66E-4278-AC38-E0541DAA3621}",_
"{5E2C544D-539F-412D-BE71-0EBC7083841C}",_
"{5FCDC863-72E2-4C1A-86B2-593018307B1C}",_
"{6034D614-E53F-46F2-B0BC-280222D569C2}",_
"{79EE919C-7A93-4868-8B42-EF8F9B14FFFC}",_
"{87467DDA-0189-4730-A3A6-079429D1657B}",_
"{925E8226-FBED-43FD-BC8C-41207B999AF0}",_
"{951F94FD-DDBB-4A15-B8E7-1560D3D28900}",_
"{A6D5C59E-F97B-4665-B811-DC93635E05B0}",_
"{AD98F2ED-D92A-43AA-9F28-0466928AA13C}",_
"{AF2E0395-7695-41E8-AC23-D58C328126F7}",_
"{B61393AC-4E96-497B-8314-1F18B3FE9474}",_
"{B904F122-BACE-41BD-8BE0-1FFA8E8E3135}",_
"{BB3E5DFB-5EAD-4E2C-A0B5-71045C0784FF}",_
"{BC9FD7FB-5929-47F7-9B24-D9237B14F26E}",_
"{BE0B37FE-EF39-4B9C-A329-904616EE633C}",_
"{C2ECE9F2-CAB3-4EFE-B45B-2D08B2954AF5}",_
"{C8FE6530-2E39-4563-A7D8-183C7FA2B76A}",_
"{CBA13F11-D29E-48CC-9EBC-F122567F9119}",_
"{CD124C12-BEFD-4DBA-A915-A2F995F56B13}",_
"{D4CAD0A4-A14D-4F70-A8CB-475776C76CF8}",_
"{D6EA1689-AA4C-4CF6-862C-87D9877F3651}",_
"{D9CFF2FF-620F-4842-A075-8A0769816FA4}",_
"{E8542277-8C9D-4CC9-8D92-7C126EE7110E}",_
"{EC482C6E-8F7F-4187-BB4C-841E1B64022B}",_
"{EE1B5DDC-BE68-4F19-BEEE-7FFD4DD43BFD}",_
"{F594EA1A-5603-4B82-B624-BE1F807BC8E1}",_
"{FEAD3C72-1A18-4BAB-94FB-E508C31B2E79}"_
)
' 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
        Else
            WScript.Echo "Successfull uninstall of ZenWorks Version: " & Value
        End If
    End If
Next
'Cleanup
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” }
    $app.Uninstall()

  • 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