Uninstall the Dagent
search cancel

Uninstall the Dagent

book

Article ID: 178456

calendar_today

Updated On:

Products

Deployment Solution

Issue/Introduction

Uninstall the GSS DAgent with the script below.

Environment

GSS 3.3.x

Resolution

The following .vbs script enumerates all the uninstall keys to see where the InstallLocation value is set to the DAgent default install path and then runs the MSI uninstall command: Copy this script out to a notepad/wordpad and save as a .vbs. The call this script in a run script job. This will not run if you copy it into the run script job as is must be saved as a .vbs file

On Error resume next

const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

 

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

set objShell = CreateObject("Wscript.Shell")

 

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

strInstallLocation = "InstallLocation"

strUninstallValue = "UninstallString"

 

objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

 

For Each subkey In arrSubKeys

 

                objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & subkey, strInstallLocation, strValue

               

                If strValue = "C:\Program Files\Altiris\Dagent\" then

                                objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & subkey, strUninstallValue, strValue1

                                objShell.run "MsiExec.exe /qn /uninstall " & subkey

                                wscript.quit

                End If

   

Next

Note: Please test this script thoroughly before using it in production.