SCCM Client (SMS) Cleanup – Powershell Script

This script is stopping the SMS Host Service, removing the SMSCFG file, cleaning the Cert Store, uninstalling CCMSETUP, and removing the CCMSETUP Registry. It is used to completely remove the Configuration Manager client from a Windows computer.

#Copy and the save the following script as .PS1 

Write-Output "Stoping the SMS Host Service"
stop-Service Ccmexec

Write-Output "Removing SMSCFG File"
Remove-Item -Path "$($Env:WinDir)\smscfg.ini" -Force -Confirm:$false -Verbose

Write-Output "Cleaning the Cert Store"
Remove-Item -Path 'HKLM:\Software\Microsoft\SystemCertificates\SMS\Certificates\*' -Force -Confirm:$false -Verbose

Write-Output "Uninstalling CCMSETUP"
C:\Windows\ccmsetup\ccmsetup.exe /uninstall

Write-Output "Removing CCMSETUP Registry"
Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\CCMSetup' -Force -Recurse -Confirm:$false -Verbose

Related Posts