On Error Resume Next Set WshShell = WScript.CreateObject("WScript.Shell") Set WshSysEnv = WshShell.Environment("Process") DrivePath = WshShell.ExpandEnvironmentStrings("%SYSTEMDRIVE%") checkOSArch = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE") if Err Then Err.Clear regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\AdventNet\DesktopCentral\DCAgent\" else if checkOSArch = "x86" Then regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\AdventNet\DesktopCentral\DCAgent\" else regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\AdventNet\DesktopCentral\DCAgent\" End IF End If agentVersion = WshShell.RegRead(regkey&"DCAgentVersion") if Err Then Err.Clear Else WshShell.Run "msiexec.exe /x{6AD2231F-FF48-4D59-AC26-405AFAE23DB7} MSIRESTARTMANAGERCONTROL=Disable REBOOT=ReallySuppress /qn "&DrivePath&"\dcagentInstaller.log",0,True if Err Then Err.Clear 'Removing the Agent from Add Remove Programs (if uninstallation failed) '===================================================================== WshShell.RegRead("HKEY_CLASSES_ROOT\Installer\Products\F1322DA684FF95D4CA6204A5AF2ED37B\SourceList\Net\") WshShell.RegDelete "HKEY_CLASSES_ROOT\Installer\Products\F1322DA684FF95D4CA6204A5AF2ED37B\SourceList\Net\" WshShell.RegDelete "HKEY_CLASSES_ROOT\Installer\Products\F1322DA684FF95D4CA6204A5AF2ED37B\SourceList\Media\" WshShell.RegDelete "HKEY_CLASSES_ROOT\Installer\Products\F1322DA684FF95D4CA6204A5AF2ED37B\SourceList\" WshShell.RegDelete "HKEY_CLASSES_ROOT\Installer\Products\F1322DA684FF95D4CA6204A5AF2ED37B\" 'Uninstall Agent and Remote Control Service (if uninstallation failed) '===================================================================== WshShell.Run "%windir%\system32\sc stop " &Chr(34)& "ManageEngine Desktop Central - Agent" &Chr(34),0,True WshShell.Run "%windir%\system32\sc delete " &Chr(34)& "ManageEngine Desktop Central - Agent" & Chr(34),0,True WshShell.Run "%windir%\system32\sc stop " &Chr(34)& "ManageEngine Desktop Central - Remote Control" &Chr(34),0,True WshShell.Run "%windir%\system32\sc delete " &Chr(34)& "ManageEngine Desktop Central - Remote Control" & Chr(34),0,True End If End If