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”

  • Sole:

    Today I debugged an error when using this script to uninstall ZenWorks, on a very few installations, it would hang and never continue, so the script would never complete, and never ask the machine to reboot. The clients would never get ZenWorks uninstalled. When trying to manually uninstall ZenWorks I found the cause, and have now implemented a small 1 line fix to solve this problem.

    The problem causing the “hang” during uninstall is described on Novell here http://support.novell.com/docs/Tids/Solutions/10095223.html Basicly it says that the ZENworks mangement agent on a very specific version gets stuck on “Starting…” and therefore the uninstall cant stop the service and continue. I opted for the fix of just killing the task, since i dont realy care if it stops cleanly, after all I am removing it !

    I have added the extra lines in the original post.

  • saulnier:

    bonjour je suis actuellement en stage et mon tuteur ma demander de faire un script ou un .exe car nous quittons netware pour de l’open source et votre script conviendrait a sa demande mais cependant je ne c pas quoi reprendre car kan je reprend presque tout une foi que je le lance il me met un message d’erreur merci de me guider

  • saulnier:

    Hello I am currently in my internship and my tutor asked to make a script or. exe netware because we leave for the open source and your script should have its application, but yet I do not c anything back because when I follow almost all a faith that I run it it makes me an error message to guide me thank you

  • Sole:

    Hi Johann,
    I am having a little trouble understanding. I assume you are asking the following, please correct me if I am wrong. You are looking for a script or executeable that will remove ZenWorks?
    But You do not get any feedback when running the script?

    You can run the script, by saving the text in notepad, with a filename.vbs
    then run it with for example this command: cscript.exe filename.vbs

    If you did it correctly, it should output Successfull or Unsuccessfull uninstall of ZenWorks if it finds a ZenWorks installation in registry. Note I do NOT have all the GUID’s associated with ZenWorks, only the ones I have seen in my work.

    You can add this line in the end of the script to check that it runs correctly.

    wscript.echo “Script completed.”

    If you do have zenworks installed, but it doesnt uninstall it, open regedit and go into this key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

    Now go thru each GUID {some-long-number} and find the one with a ZenWorks name inside it.
    Add the GUID you find and add it like the others in the script. It should now be able to remove your version.

    Enjoy!

  • Sole:

    Found another GUID for ZenWorks {17ABBB0D-F2B1-4C78-A64F-2DC1C1E7A4DE}

  • Found a GUID for ZenWorks that we have {20F7117E-1B6F-4EEC-8F47-FB7A142FAC12}

  • 02J:

    Excellent script. I added a small modification to write results to a SQL DB.

    Here are some additional Agent GUIDs with Version:

    “{C5E122A0-09A8-4B9D-A010-9B20F5348C09}”_ ‘ 6.5.14.40614
    “{F5DB4286-0064-4574-936B-09115C7A5A07}”,_ ‘ 6.5.84.50204
    “{0028ED8D-E938-4B81-B636-F20B3207086F}”,_ ‘ 7.0.101.70213
    “{17ABBB0D-F2B1-4C78-A64F-2DC1C1E7A4DE}”,_ ‘ 7.0.7.50808

    Here’s what relevant portion the original code + my SQL code looks like: (I’m not sure why I needed the portion “Version = Value”. When I tried to use Value directly it wouldn’t work. The sections enclosed in will need to be replaced with appropriate settings for your environment.)

    ‘ 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 Key, SubKey & GUID, ValueName, Value2
    If Value = Value2 Then
    WScript.Echo “UN-Successfull uninstall of ZenWorks Version: ” & Value
    sAction = “Failure”
    Version = Value
    Else
    WScript.Echo “Successfull uninstall of ZenWorks Version: ” & Value
    sAction = “Success”
    Version = Value
    End If
    End If
    Next

    Set objNetwork = CreateObject(“Wscript.Network”)
    strComputerName = objNetwork.ComputerName
    Set mConnection = CreateObject(“ADODB.Connection”)
    mConnection.Open “Provider=SQLOLEDB.1;Data Source=;Initial Catalog=”,””,””
    Set rs = mConnection.Execute(“SELECT NEWID()”)
    If Not rs.EOF Then GUID = rs(0)
    mConnection.Execute “DECLARE @GUID uniqueidentifier; SET @GUID = ‘” & GUID &”‘; INSERT INTO (ID, Computer, Action, Version, Time) VALUES (@GUID, ‘” & strComputerName & “‘, ‘” & sAction & “‘, ‘” & Version & “‘, ‘” & Now() & “‘)”
    Set mConnection = Nothing

  • 02J:

    (Portions of the last post were stripped, replaced the with [].

    Excellent script. I added a small modification to write results to a SQL DB.
    Here are some additional Agent GUIDs with Version:
    “{C5E122A0-09A8-4B9D-A010-9B20F5348C09}”_ ‘ 6.5.14.40614
    “{F5DB4286-0064-4574-936B-09115C7A5A07}”,_ ‘ 6.5.84.50204
    “{0028ED8D-E938-4B81-B636-F20B3207086F}”,_ ‘ 7.0.101.70213
    “{17ABBB0D-F2B1-4C78-A64F-2DC1C1E7A4DE}”,_ ‘ 7.0.7.50808
    Here’s what relevant portion the original code + my SQL code looks like: (I’m not sure why I needed the portion “Version = Value”. When I tried to use Value directly it wouldn’t work. The sections enclosed in [], will need to be replaced with appropriate settings for your environment.)

    ‘ 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 Key, SubKey & GUID, ValueName, Value2
    If Value = Value2 Then
    WScript.Echo “UN-Successfull uninstall of ZenWorks Version: ” & Value
    sAction = “Failure”
    Version = Value
    Else
    WScript.Echo “Successfull uninstall of ZenWorks Version: ” & Value
    sAction = “Success”
    Version = Value
    End If
    End If
    Next

    Set objNetwork = CreateObject(“Wscript.Network”)
    strComputerName = objNetwork.ComputerName
    Set mConnection = CreateObject(“ADODB.Connection”)
    mConnection.Open “Provider=SQLOLEDB.1;Data Source=[sql server name];Initial Catalog=[database name]”,”[databse username]”,”[database password]”
    Set rs = mConnection.Execute(“SELECT NEWID()”)
    If Not rs.EOF Then GUID = rs(0)
    mConnection.Execute “DECLARE @GUID uniqueidentifier; SET @GUID = ‘” & GUID &”‘; INSERT INTO RemovalActions (ID, AD_Computer, Action, Version, Time) VALUES (@GUID, ‘” & strComputerName & “‘, ‘” & sAction & “‘, ‘” & Version & “‘, ‘” & Now() & “‘)”
    Set mConnection = Nothing

  • Sole, will this script run for users with limited policy rights? Or, if possible, can the script run in what’s know as workstation security space?
    Thanks!

  • Sole:

    Hi Jeff,
    I would guess that the script would be unsuccessfull if used for users with limited rights, i.e. if they are not able to remove an application in add/remove programs, then this script should not work. Otherwise it should be fine.
    As far as I can tell I am not using any user specific tools/registry or other modules, so it should be fine to run it under computer context, i.e. in a computer startup script in a GPO.

    If You use it for either, please let me know if it works 🙂

  • Greg:

    This may be a silly question, but this appears at first glance to be for removing the ZFDAgent from the workstations…or is this applicable to removing Zenworks from Windows servers? For what it’s worth, we’re moving from ZENworks 7 to Symantec’s Altiris and the ZENworks cleanup is horrible.

  • Sole:

    This script can actually be used to uninstall a lot of different software. It looks for the uninstall GUID of the program and runs msiexec with the uninstall /x parameter and the GUID as identifier.

    So I would guess that this could be used on servers and workstations with no problems. All you have to do is look at a server and find the program that you want uninstalled in registry and find its guid. if it is not allready here.

    If nothing else you could always try running the script on a server, it will only uninstall software that matches the guids in this post (dont forget to add the extra ones reported in comments, and if you find new GUIDs for the agent add a comment with them for others to use)

  • Compaq:

    Hi sole
    need to uninstall the zen works agent which is placed in almost 3000 desktops, Could please give the right code either a batch file or a vb so that i can include in users logon as they login with novel client id(using Edirectory)

  • Sole:

    The code on the web page is correct, but look out for formatting changes when you copy it, for example ‘ might be changed to ´` etc. If you can’t get it to work, feel free to send me an e-mail at sole@sole.dk and i will send you the code in a txt file.

  • DanV:

    found key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C5E122A0-09A8-4B9D-A010-9B20F5348C09}

  • bzb:

    I found the following guids on a w2k3 server with zenworks…

    ZENworks Novell ZENworks
    {0119D30B-B3B4-43D4-B6AA-2EE083F844D1} ZENworks Windows UI
    {01CF6858-22D9-46A8-841F-97476E942574} ZENworks Imaging Server
    {0440ACAC-4E38-4C0C-97B8-87E1DE4B655E} zennotifyicon-langs
    {055FB117-BBD8-4B7C-A954-76118656B78D} ZENworks Agent Inventory Management
    {0D915E98-607B-40FF-A934-DA6CD5FCFFFE} ZENworks Uninstaller
    {17A94CB0-158C-4707-B8BE-AF836A9DDD63} ZENworks Content Distribution Point
    {1AB341C8-1409-404E-8EC3-249211F52EBA} assetmanagementmodule-langs
    {1D3B116B-8E32-46A2-AD39-90E08357FAC6} ZENworks Version Information
    {27E6FD9C-EED1-4F52-8C58-3548ACC2B709} status-collection-point-langs
    {2F50152F-33D7-406B-8FB4-B4B230178971} ZENworks Image-Safe Data Agent
    {34FDA8EB-BD13-42ED-BF3D-44CA19EBE0C4} ZENworks Action Utilities
    {377D684E-E6F9-43CE-802A-71F1977477C7} Novell ZENworks Remote Management
    {37E407DC-6E15-406C-8E1B-55E93129AFDC} windows-desktop-langs
    {3912E9C4-14EB-4467-8900-5362F392BB82} ZENworks Group Policy Handler
    {3977FC4F-0313-43F7-8F83-04A461BF5389} ZENworks Agent Bundle Management
    {3C6849B6-1953-4DAF-9A8B-783FB72F3CBB} Novell CASA Authentication Token Client
    {45F554A5-5326-4FBD-AE41-B602AFFF8959} ZENworks Actions
    {52336B06-9673-41A2-A0BA-185953CAB9BA} Policy Action Handler Resources
    {5605721C-284F-47F5-8DA9-81AE6F3F4FA7} WinProxy-langs
    {5720A5EC-42D3-47D4-9D71-E7AD0B477731} bundle-langs
    {57FE61B4-2983-4772-9FB6-E86159F20B85} ZENworks Agent Authentication Satellite Module
    {6034D614-E53F-46F2-B0BC-280222D569C2} CASA
    {621BC965-9FEE-493C-9512-FF2DC2827C79} actions-langs
    {643CC14D-3E10-4E0D-B6AB-2986C8EB2728} ZENworks Policy Libraries
    {68659F27-E4BF-43B7-8AF0-4BC60AA4A5AD} ZENworks Agent Policy Management
    {6A0BF713-FB12-44FA-A566-26E1C1B7BE16} ZENworks Agent System Update Module
    {76F7DB30-6714-4EEC-A2AD-DABE981ADC3D} ZENworks Information Icon
    {7AFFF9F6-F947-46C8-8C23-6625C9F9E776} content-distribution-point-langs
    {8979ED18-582E-4A66-933C-AF729B711E18} remotemanagement-langs
    {8A9EB562-86D9-44FF-887F-45A3193B6137} ZENworks Agent Core Modules
    {95FD9D9E-0AD1-462A-84A5-88106D2A3816} ZENworks User Management
    {981BAD43-4918-4D89-BB61-CBA93CC91B11} Policy Handler Resources
    {9B3DB378-9354-41D8-8BD7-347679F880CA} ZENworks Extensions Libraries
    {9F2422FB-372A-4889-BA23-524B3861BCB1} auth-satellite-server-langs
    {A37B2A89-F514-4AE8-AC29-1FF09B1C0E8E} Action Handler Resources
    {A77614E9-4E97-4D75-A985-55541A040541} ZENworks Action Handlers
    {A8092107-CF7B-40AF-85A3-2868CED8D83E} ZENworks Agent WinProxy Module
    {A95E717D-9EDA-4D7E-8D00-FB70A1812E70} inventory-langs
    {B467E4E0-A1EE-4371-9F91-8A3697B65AC5} ZENworks Policy Handlers
    {B5C63A12-C66B-4E97-A27C-912E7D5985BD} ZENworks Image Management
    {B65FF273-7F1B-4BCC-8FDA-DE95B003E0AE} ZENworks Remote Management
    {B9887A00-DC52-4539-83DD-4C0AC5FB85FD} Microsoft Redistributable Files (x86)
    {BA97575F-6577-4420-A535-53F54A9B92DC} Novell ZENworks Adaptive Agent Help
    {C0DC6D61-5F52-4D3E-938F-A77DD842D66B} ZENworks DLU Policy Handler
    {C17CF6AD-63A6-49EE-98C2-64E90C6ED16B} ZENworks Agent Asset Management Module
    {C22F21E8-6C44-434B-9093-230AEFF7D230} ZENworks Launcher Policy Handler
    {D6C5BB8D-8A3A-495F-8252-DF4E0731209B} Novell ZENworks Endpoint Security Agent
    {D826DFEE-C721-4895-9E04-43FB233B7F87} policy-langs
    {F009A680-C4A5-47B9-83C1-E79BB870664E} usermanagement-langs
    {F342F1F8-2E95-4D38-BD9F-16FD7212232B} ZENworks Primary Agent
    {F7C1CBEF-4EC1-4EB6-A976-05AAC1C1A68A} zencore-agent-langs
    {FCA31B47-B2B4-424D-9C30-A06F886BAD7C} ZENworks Status Collection Point

    I got these by writing a script to query all subkeys under hklm\ms\windows\currver\uninstall:

    Const HKLM=&H80000002 ‘HKEY_LOCAL_MACHINE

    Set oReg = GetObject(“winmgmts:!root/default:StdRegProv”) ‘ Registry access

    key = “SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\”
    ValueName = “DisplayVersion”
    keyType = REG_SZ

    wscript.echo “Enumerating all zen items…”

    oReg.EnumKey HKLM, key, arrSubKeys

    For Each subkey in arrSubKeys
    oReg.GetStringValue HKLM, key & subKey, “DisplayName”, displayName
    oReg.GetStringValue HKLM, key & subKey, “InstallSource”, installSrc

    if instr(lcase(displayName), “zen”) > 0 or instr(lcase(installSrc), “zen”) > 0 then
    Wscript.Echo vbtab & subkey & vbtab & displayName
    end if
    Next

  • Patrick Farrell:

    Instead of making an array of all product codes, why not just pull the current product code from the registry?

    GUID=GetProductCode(“ZENworks Desktop Management Agent”)

    That’s how I do it here and it works well with the script that I use for uninstalling msi’s.

  • Sole:

    I actually considered changeing the code, so instead of looking for GUID’s it would compare the displayname instead.. Would be more flexible with new versions and work with any program you wanted to remove.

  • Sole:

    That is a lot of ZenWorks 🙂

  • Dann:

    You can add to the list a vintage edition of ZenWorks…

    {E969D49E-05B2-4DB2-90E0-F4D9CB1722FE} is version 4.00.1043

    Thanks Sole!

  • Anthon:

    Just wanted to share my modification of the original script.
    This i use to uninstall zenworks 10.3.3

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

    Const HKLM=&H80000002 ‘HKEY_LOCAL_MACHINE
    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
    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”
    KeyType = REG_SZ
    ‘ 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 <a href="http://www.sole.dk“>http://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}”_
    )
    ‘ 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 Key, 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

    ‘Stop ZENworks Deamon and ZENworks Notify Icon
    Set colProcessList = objWMIService.ExecQuery _
    (“SELECT * FROM Win32_Process WHERE Name = ‘ZenUserDaemon.exe'”)
    For Each objProcess in colProcessList
    objProcess.Terminate()
    Next
    Set colProcessList = objWMIService.ExecQuery _
    (“SELECT * FROM Win32_Process WHERE Name = ‘ZenNotifyIcon.exe'”)
    For Each objProcess in colProcessList
    objProcess.Terminate()
    Next

    ‘Remove Novell ZENworks Preagent Service
    Set colListOfServices = objWMIService.ExecQuery _
    (“Select * from Win32_Service Where Name = ‘ZENPreAgent'”)

    For Each objService in colListOfServices
    objService.StopService()
    objService.Delete()
    Next

    ‘Restart explorer.exe
    dim strComputer
    dim wmiNS
    dim wmiQuery
    dim objWMIService
    dim colItems
    dim objItem

    wmiNS = “\root\cimv2”
    wmiQuery = “Select processID from win32_process where name = ‘explorer.exe'”

    Set objWMIService = GetObject(“winmgmts:\\” & strComputer & wmiNS)
    Set colItems = objWMIService.ExecQuery(wmiQuery)

    For Each objItem in colItems
    objItem.terminate(1) ‘need 1 to keep from restarting explorer
    Next
    Dim obj ‘uses get method to get win32_process so we can launch new explorer
    Set obj = objWMIService.Get(“win32_process”)
    obj.create(“explorer.exe”)

    ‘Remove Novell ZENworks PreAgent files
    Set filesys = CreateObject(“Scripting.FileSystemObject”)
    filesys.DeleteFolder “C:\Windows\Novell\Zenworks”
    filesys.DeleteFolder “C:\Program\Novell\zenworks”
    ‘Cleanup
    Set objReg = Nothing
    Set WshShell = Nothing
    Set colProcessList = Nothing
    Set colItems = Nothing
    Set colListOfServices = Nothing
    Set objWMIService = Nothing
    Set objReg=GetObject = Nothing
    Set obj = Nothing
    Set filesys = Nothing
    msgbox “Please reboot…”

  • Tam:

    Are you guys running this script via a group policy in AD or via the Novell Login Script?

  • Tam:

    And is there a way to tell the script to run with administrator credentials/rights? The users in my environment do not have admin rights, but there is a local admin account on each machine with admin rights.

  • Sole:

    I used GPO to run it, but you could use anything that will start script, i.e. cscript myfile.vbs

  • Sole:

    This is a general problem with scripts. Either you will use an approach where you do a run-as for the script, or you will find a way to execute it with higher permissions, i.e. GPO script that will execute with higher permissions than the user logging on to the machine.

  • Sole:

    Thanks for taking the time to share 🙂

  • Sole:

    Thanks for sharing 🙂

  • Søren Møller:

    ok is not working for me at all, no reply back from vbs on 2008 servers, on 2003 i get reply version 1.7.1630, and then successfull zenworks version 1.7.1630 uninstall, but zenworks is still install at the server. I am on The ZENworks Adaptive Agent Version: 10.3.0.27649.

  • Sole:

    Hej Søren,

    It sounds like you have a general problem running the VBScripts, perhaps permissions? Are you running theese in a command prompt with administrator permissions? (Right click Run As Admin)
    As you are having problems with both scripts, I am guessing it is a problem with scripts or permissions. Both use registry to search for clients, so try and look with regedit if you can find the keys the script search for.

    Ellers kan du smide mig en e-mail med nogle screenshots, hvis det stadig driller.

    -Sole

  • Chris:

    Thanks for this script! We have a lot of workstations that are no longer communicating with the Zenworks server, but still have the agent. For the time being, I’m just using it in a login script to simply inventory the Zenworks components that are installed. I want to use it to remove the agents, in the future, but I have some questions.

    Is it necessary to uninstall every GUID related to Zenworks? Won’t some of them get uninstalled automatically when the Agent is removed? Also, is it likely that removing any of these could render the Novell Client inoperable? is there a presecribed order for uninstall?

    Thanks, again.

  • Sole:

    Hi Chris,

    I am sorry but it is so long since I used this script my self, that I can’t answer you questions off the bat. You will need to do your own testing for what works in your environment with your versions of the software. The way I did it where I used it, was identifying the GUID’s I needed to remove to achieve what I wanted (remove all ZenWorks and Novell clients), and give them to the script so it would remove them.

    I didn’t have problems with the order of removal, the script just removes a program and goes looking for the next one on the list. So if one uninstalls another it won’t really make a difference. But you should test this for your system.

    -Sole

  • Chris:

    It’s been helpful, so far, in identifying the workstations that still have the agent installed. I hope to do some test uninstalls in the next day or so. We’re not removing the Novell Client, so it will be interesting. Thank for the help!

  • Phil Goldwasser:

    I am trying to use the original vbs script and I keep getting an error –

    Line 1
    Char 1
    Error Invalid character
    Code 800A0408
    Source Microsoft VBscript compilation error

    I am not a programmer by any definition and I do not see why the first character of the script should be causing this. Clearly lots of others have this working.

  • Sole:

    Most likely your editor is copying the source code from HTML and translating ‘ into ´ or `

  • Søren Møller:

    I have remove my zenworks installations using this, run by administrator or use with admin rights.

    ________________________________________________

    @echo off
    Echo “Nu fjernes Zenworks med bruger %username%” >> c:\zen_remove.txt
    Echo “%ZENWORKS_HOME%\bin\zenworksuninstall.exe” >> c:\zen_remove.txt
    Echo “Uninstall startet %date% – %time%” >> c:\zen_remove.txt

    “%ZENWORKS_HOME%\bin\zenworksuninstall.exe” -c -q
    call MsiExec.exe /X{E016C7E1-AC80-4C90-9F8B-3EF16ABA2834} /q
    call MsiExec.exe /X{F5313E94-F17E-4AF6-8E46-6D97ECF4C37} /q
    call MsiExec.exe /X{71A7E068-AEBB-4B1A-AED6-398B987A5B5C} /q
    call MsiExec.exe /X{C8454298-0208-440E-9A60-8DC277E35BA0} /q
    call MsiExec.exe /X{299D7ED0-47CD-4A2A-A7DD-E9624A9A0BF4} /q
    call MsiExec.exe /X{3C6849B6-1953-4DAF-9A8B-783FB72F3CBB} /q
    call MsiExec.exe /x{08044C1C-760B-45D1-81B7-10C690313012} /q
    call MsiExec.exe /x{FE0D2049-AD64-418D-A2BD-5C60B940F27D} /q
    Call MsiExec.exe /X{B27E0CE7-EA0F-4735-87D3-BAD8E675A020} /q
    CALL MsiExec.exe /X{E256408F-0FA0-418F-88D9-F4980648F5E0} /q
    Call MsiExec.exe /X{FE0D2049-AD64-418D-A2BD-5C60B940F27D} /q
    Taskkill.exe /f /im zennotifyicon.exe

    Echo “Uninstall sluttet %date% – %time%” >> c:\zen_remove.txt
    exit

  • What can we do, when the first command don’t work
    “%ZENWORKS_HOME%\bin\zenworksuninstall.exe” -c -q

    Error-Message: no agent found

  • Sole:

    If you do have ZenWorks installed, see what would be required to manually uninstall the program.

  • Phil Pritchett:

    Thanks for the script! It’s a great start. I will be modifying to parse the registry for ALL ZENworks entries instead of using a static array. This should uninstall the ZEN client dynamically no matter the version as well.

    Once I have it completed, I will post a copy for you.

  • Sole:

    Sounds like a good plan. You could parse all install entries and just do string matching on the entries to find the ZENworks packages.
    I did consider this at one point, but then the current script was working, so there was no need to do the change.

    -Sole

  • Philip Damian-Grint:

    Hi Sole,

    Thanks for the script, it’s a very useful all-purpose uninstall tool.

    There appears to be a problem with the second call to objReg.GetStringValue where the uninstall is checked. Instead of passing the variable HKLM as it does in the pre-uninstall check, it passes a variable called Key – this isn’t referenced anywhere else in the code and therefore doesn’t contain anything.

    The result is that for me at least, the code always says that it uninstalled successfully, even if I comment out the taskill and msiexec steps so that they never run. I think it’s because Value2 will always be blank and the compare will never match.

    I note also that the variable KeyType is set to REG_SZ which ends up setting a blank variable to another blank variable because neither of them are referenced anywhere else and REG_SZ is presumably missing quotes. I suppose this is just an artefact from an earlier version.

  • Sole:

    Hi Philip,

    Thank you for sharing, your corrections are spot on 🙂
    And the reason for them being there is due to having been part of a longer script where this was used.
    I haved updated the script on the page and txt file for download.

    -Sole

  • Todd Allis:

    Thanks! This will be easy to adapt to my needs and save me a lot of time.

  • Hi Sole,,,

    I am new for the novell, i have install the Zenworks 11 Sp 1 on the Server and all the clients are connected with the server. but due to some issue “ZesService is not Running” Error and some Policy applied failed on the client. Due to that i need to uninstall the clients of 11 sp 1. Can you tell me this script will work on this version.

    Please reply….

  • Gary:

    Also, these (ZCM 11.2.3″

    “{B42E5A06-005F-48CB-94AD-71D6A924E733}”,_
    “{196E46D7-CCB3-4009-8A5E-DD2C0743171B}”,_
    “{DB6A657E-5F90-4B56-954B-F53F6F9A53C7}”,_
    “{235938BA-BA6A-4289-90D9-6E650F3EEA5B}”,_
    “{9A4C763D-C1E0-4521-AA3E-E9A22B50C1EF}”,_
    “{2CF1ABE4-01E6-4928-B56A-B7A4A700CA68}”,_
    “{31AFAE5B-0EB7-4745-A39F-8FD9AEF28E48}”,_
    “{7246F159-C766-42B6-9D99-09CBC9AF4EAF}”,_
    “{46F2C450-9D5D-43D6-8FEE-AAF153120DB0}”,_
    “{D888FEAB-349E-424D-9A44-332DA8E4B878}”,_
    “{9F0AE21B-CFDD-47FA-BA4F-9A58E5206C9D}”,_
    “{BD300ADB-5462-4D39-92DA-924E05AE65CF}”,_
    “{976F6B9C-0ED7-43D0-9FCF-192798F0CB12}”,_
    “{56199E9F-A9B3-4EBF-B703-6FFB7314A79F}”,_
    “{D81B59C3-1208-4F85-80B3-D3D6F0E8C33D}”,_
    “{3ECC5F37-EB53-4D86-BEF5-5DD791482AC9}”,_
    “{38C6EAD7-DF44-4B5D-9627-5E687A0051AC}”,_
    “{80C365FC-37B7-44A0-96CF-673ACA755D03}”,_
    “{849F645A-0262-4740-B06D-BDDAEAFFA338}”,_
    “{E1CE2A7C-80A3-46E7-8E30-6F189A7F0779}”,_
    “{39BD45A8-98F9-4C65-A0CE-CBB26E1A41B9}”,_
    “{CA463E9E-72E1-4015-AF63-7454CFE054C7}”,_
    “{5A6CB8A0-73F5-4697-BE9C-65C225CB342A}”,_
    “{23ECEDC1-FF06-46BC-91D3-BD48A2C02AC4}”,_
    “{217D4303-A6B2-4E01-B561-728E12D42F18}”,_
    “{612EBC80-2BE4-4C95-9002-983DB3A28E63}”,_
    “{27900E22-17D7-4D50-BC28-D54465665436}”,_
    “{B32F3372-410D-4109-A4B5-CF5FD0FEC631}”,_
    “{4FCDC1B4-23DE-4D08-991F-717E251A36C9}”,_
    “{00650916-8B28-4669-BB7F-7D64457FFC2F}”,_
    “{174960B6-7345-4F0C-8A4E-1B2D44650669}”,_
    “{6FE7E3B7-5CC6-4439-B126-CDC7DFBDFE64}”,_
    “{500215B7-AF4F-4C86-9F87-561923AF1F83}”,_
    “{C2064E0B-0F4B-4E2E-AF40-CA96800B3BA8}”,_
    “{F2A3C51B-16AD-4BF1-ADBF-4B748C6BA89E}”,_
    “{F16D1EFB-FAAF-488D-BE33-9F2963A243B7}”,_
    “{25D7573C-75EE-48A3-8706-B677D3CAF246}”,_
    “{18CF3A7C-3742-45D9-8662-EEC0BE4BE171}”,_
    “{BCDB29DC-2720-4B45-80C5-412BE3EBC018}”,_
    “{1216A50F-4ACB-4BD7-A41F-3BAB8B8324EC}”,_

  • Jay:

    Hello Sole,

    Thank you very much for this tool. Great script, only had to make one change for x64 Windows 7, the subkey needed to get changed: SubKey = “SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\”
    after that, this tool worked like a champ. Appreciate your help!

  • Anonymous:

    Thanks.
    By changing the GUIDs, I was able to make this script remove Mimecast Services for Outlook (MSO) using a startup script so I didn’t need to grant elevated privis to the end users.

  • chihab:

    downloaded the text version removezenworks2.vbs.txt
    and changed only the line :
    SubKey = “SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\”
    to reflect my workstations OS (win7-64-bits). when runing the vbs as administrator nothing happen : i got the following Windows :

    C:\cz>cscript.exe C:\cz\removezenworks2.vbs
    Microsoft (R) Windows Script Host Version 5.8
    Copyright (C) Microsoft Corporation 1996-2001. Tous droits réservés.

    thank you for your help.

  • chihab:

    unable to run the script on windows 7 – 64bits
    please help
    tank you

  • chihab:

    any response ?
    thank you.

  • Sole:

    Hi Chihab,

    Sorry but I am not able to help you with how to run the script or debugging if it does not work on your machine.

    -Sole

Leave a Reply