Remove the advanced client

I often get asked how to remove a client (normally advanced) from a remote box.
I am sure we all know the method of using ccmclean and psexec.exe
share ccmclean then use the following command

psexec.exe \\clientname -u domain\adminusername -p password \\share\ccmclean /client /q

I then had a thought, the advanced client is an installed application so I am sure you can just signal it to be removed via WMI, and so the script below was born

strTargetComputer = WScript.Arguments.Item(0)
strApplicationName = "SMS Advanced Client"

Set wshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strTargetComputer & "\root\cimv2")

Set colSoftware = objWMIService.ExecQuery ("Select * From Win32_Product where Name = '" & strApplicationName & "'")

For Each objSoftware in colSoftware
 If objSoftware.Name = strApplicationName Then
 ApplicationFound = True
 Wscript.Echo "Uninstalling Application" & strApplicationName & " From " & UCase(strTargetComputer)
 objSoftware.Uninstall()
 Wscript.Echo "Done"
End If

Next
 If ApplicationFound <> True Then
 Wscript.Echo strApplicationName & " Is Not Installed On "  & UCase(strTargetComputer)
End If

Please use the script responsible, and don't blame me if it breaks anything  Wink

Published Tuesday, December 04, 2007 10:58 AM by scambler

Comments

# re: Remove the advanced client

Nice approach Dave!

Don't forget for the PSEXEC examples you can also tell MSIEXEC to remove the SMS Client

MSIEXEC /X {ProductGUID}

You can find the GUID here:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Wednesday, December 05, 2007 2:56 PM by Rob - MVP