Worklet: Remove SCCM Agent

  • 20 October 2020
  • 1 reply
  • 210 views

If anyone else is in the same boat of wanting to remove Microsoft System Center Configuration Manager agents from endpoints and servers this is the worklet we used to accomplish it.


Evaluation script (cache folder only exists if client was configured):


if( Test-Path -Path "C:\Windows\ccmcache" )
{
exit 1
}

Remediation script (using official Microsoft method):


$process = Start-Process -FilePath "C:\Windows\ccmsetup\ccmsetup.exe" -ArgumentList '/uninstall' -PassThru
Exit $process.ExitCode

1 reply

Badge

Hi derek, in otherwise, if i want to use a worklet to install the SCCM client, how would be the evalution code?, when is possible that the machine already has the client installed and the folder exist, but pointing to an old sccm server.

This worklet is intended to be used most over remote machines that connect to system center over VPN.

So the remediation code should works exist or not the ccmcache folder.

I already has the remediation code ready and tested, just need the evaluation code that allow both conditions,  exist or not the ccmcache folder.

 

Any help is appreciate.

Regards

Reply