Removing SCCM clients can be a pain. We’re working on rolling out Intune and conditional access. SCCM and Intune don’t work together unless you have co-management setup. We didn’t want to do co-management and someone removed our SCCM server a long time ago. Clients were having problems enrolling into Intune because of the lingering SCCM client being installed.

To remove SCCM clients in bulk without the SCCM server, the task can get a bit hairy. But, this is the solution I found that works perfectly. I found the following script on Spiceworks and added it to a startup GPO script and PDQ deploy since I was working on a tight deadline.  This script will work with the CB version of SCCM as well.

Here is the version of the script I used:

@echo off
echo Please Wait while the system is uninstalling Microsoft's SMS/SCCM Client...

echo Checking for SCCM 2007 client...
IF EXIST %windir%\System32\ccmsetup\ccmsetup.exe GOTO DEL1
echo No SCCM 2007 client found.

echo Checking for SCCM 2012 client...
IF EXIST %windir%\ccmsetup\ccmsetup.exe GOTO DEL2
echo No SCCM 2012 client found.

echo Checking for SCCM client, alternate location 1...
IF EXIST %windir%\CCM\ccmsetup.exe GOTO DELALT1
echo NO SCCM client found.

echo Checking for SCCM client, alternate location 2...
IF EXIST %windir%\System32\CCM\ccmsetup.exe GOTO DELALT2
echo NO SCCM client found.

echo Checking for leftover folder...
IF EXIST %windir%\SysWOW64\ccm GOTO DELFOL
echo No leftover folder exists.

echo Checking for SMSCFG file...
IF EXIST %windir%\SMSCFG.INI GOTO DELINI
echo No SMSCFG file found.
echo No SMS/SCCM clients found.

GOTO END

:DEL1
echo Found SCCM Client v2007. Removing...
%windir%\System32\ccmsetup\ccmsetup.exe /uninstall
RD /S /Q %windir%\System32\ccmsetup
RD /S /Q %windir%\System32\ccmcache
echo SCCM Client 2007 removed.
IF EXIST %windir%\ccmsetup\ccmsetup.exe GOTO DEL2
IF EXIST %windir%\CCM\ccmsetup.exe GOTO DELALT1
IF EXIST %windir%\System32\CCM\ccmsetup.exe GOTO DELALT2
IF EXIST %windir%\SysWOW64\ccm GOTO DELFOL
IF EXIST %windir%\SMSCFG.INI GOTO DELINI
GOTO END

:DEL2
echo Found SCCM client v2012. Removing...
%windir%\ccmsetup\ccmsetup.exe /uninstall
RD /S /Q %windir%\ccmsetup
RD /S /Q %windir%\ccmcache
echo SCCM Client 2012 removed.
IF EXIST %windir%\CCM\ccmsetup.exe GOTO DELALT1
IF EXIST %windir%\System32\CCM\ccmsetup.exe GOTO DELALT2
IF EXIST %windir%\SysWOW64\ccm GOTO DELFOL
IF EXIST %windir%\SMSCFG.INI GOTO DELINI
GOTO END

:DELALT1
echo Found SCCM client. Removing...
%windir%\CCM\ccmsetup.exe /uninstall
RD /S /Q %windir%\CCM
RD /S /Q %windir%\ccmcache
echo SCCM Client removed.
IF EXIST %windir%\System32\CCM\ccmsetup.exe GOTO DELALT2
IF EXIST %windir%\SysWOW64\ccm GOTO DELFOL
IF EXIST %windir%\SMSCFG.INI GOTO DELINI
GOTO END

:DELALT2
echo Found SCCM Client. Removing...
%windir%\System32\CCM\ccmsetup.exe /uninstall
RD /S /Q %windir%\System32\ccm
RD /S /Q %windir%\System32\ccmcache
echo SCCM Client removed.
IF EXIST %windir%\SysWOW64\ccm GOTO DELFOL
IF EXIST %windir%\SMSCFG.INI GOTO DELINI
GOTO END

:DELFOL
echo Found leftover folder. Removing...
RD /S /Q %windir%\SysWOW64\ccm
echo leftover folder removed.
IF EXIST %windir%\SMSCFG.INI GOTO DELINI
GOTO END

:DELINI
echo SMSCFG file found. Removing...
del /F %windir%\SMSCFG.INI
echo SMSCFG file removed.
GOTO END

:END
echo SMS/SCCM Removal Procedure Complete!
exit

 

To deploy this in PDQ, I did end up having to use the 14 day free trial version and creating a new package with a single command step. This ran successfully and bulk removed all installed clients.

Share.

About Author

Hi! I'm Travis and I love technology.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.