Tuesday, 24 January 2012

Uninstalling the SCCM Client

The only supported method of uninstalling the client is ccmsetup /uninstall (See Technet).

On most systems this executable is found at C:\WINDOWS\system32\ccmsetup

But since Operating System Deployment relies on the SCCM client, how do you uninstall it as part of a task sequence? The answer is simple - schtasks.

The following command should work as the last step in a task sequence-

schtasks /create /tn "Remove SCCM Client" /tr "C:\WINDOWS\system32\ccmsetup /uninstall" /sc ONSTART /Z /ru "SYSTEM"

It should work, but I've not tested it. It's one of those things that was a requirement, but was quickly dropped, so never even got into testing.

1 comment:

Anonymous said...

Hi,

the commandline doesn´t work. The parameter /Z needs an expiring Trigger to delete itself after running. It´s possible to create that Task with /V1 but it can´t work correctly without that Trigger.

Second thing is that the Task Sequence fails because the SCCM doesn´t recieve the last error codes ;)

I wrote a very short Powershell Script which creates a Task with 15 Minutes Delay to send the error codes back to SCCM. And the Script calculates 30 Minutes up to the expire date of the Task so that it deletes it after that time. I saw that the expire Date was 2 hours on my Maschine but i think its because of the Delay or something. It´s ok for me and it works.

1) PS Script: The Post destroys the formatting. Should i send it via Email?

2) Execute PS Script: powershell.exe -file "%SystemDrive%\Konfiguration\RemoveSCCMCreateTask.ps1"

3) Import that XML File: schtasks.exe /create /tn "Remove SCCM-Client" /xml %SystemDrive%\Konfiguration\RemoveSCCMClient.xml

I recommend using the GUI generally for creating Tasks and then export it as a xml. Easy :)