' This script removes the assetexplorer agent related registry entries. On Error Resume Next const HKEY_LOCAL_MACHINE = &H80000002 Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") is64BitOS = false objReg.GetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "PROCESSOR_ARCHITECTURE", osArch if not isNULL(osArch) then pos=InStr(osArch,"64") if pos>0 Then is64BitOS = true End if End if isAgentInstalled = isServiceExist("ManageEngine AssetExplorer Agent") if (isAgentInstalled) then Set WshShell = WScript.CreateObject("WScript.Shell") if is64BitOS then WshShell.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ZOHO Corp\ManageEngine AssetExplorer\Agent\AgentId" objReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Wow6432Node\ZOHO Corp\ManageEngine AssetExplorer\Agent\", "Uninstall", uninstallString else WshShell.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\ZOHO Corp\ManageEngine AssetExplorer\Agent\AgentId" objReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\ZOHO Corp\ManageEngine AssetExplorer\Agent\", "Uninstall", uninstallString end if uninstallString = Trim(Left(uninstallString,InStr(uninstallString," /log"))) WshShell.Run uninstallString,0,True end if Function isServiceExist(serviceName) isServiceExist = false Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator") Set objService = objWbemLocator.ConnectServer("localhost", "root\CIMV2") Set colItems = objService.ExecQuery("select * from Win32_Service where Name='"&serviceName&"' or DisplayName ='"&serviceName&"'") For Each objItem in colItems serName = objItem.DisplayName if (StrComp(serName,serviceName)=0) then isServiceExist = true End if Next End Function