Skip to content

SCCM Client uninstalll script hangs.

Featured Replies

I have this script that i made to uninstall sccm client from some machines.

The script runs perfectly locally, but when i run it from a package he hangs after the line "%windir%\ccmsetup\ccmsetup.exe /uninstall."

Any Ideas why ?

 

@echo off
echo Please Wait while the system is uninstalling Microsoft's SMS/SCCM Client. 2
echo Checking for SCCM 2007 client...
IF EXIST c:\windows\System32\ccmsetup\ccmsetup.exe GOTO DEL07
echo No SCCM 2007 client found.
echo Checking for SCCM 2012 client...
IF EXISTc:\windows\ccmsetup\ccmsetup.exe GOTO DEL12
echo No SCCM 2012 client found.
echo Checking for SMSCFG file...
IF EXIST c:\windows\SMSCFG.INI GOTO DELINI
echo No SMSCFG file found.
echo All software already removed or no client installed.
GOTO END
:DEL07
echo Found SCCM Client v2007. Removing...
c:\windows\System32\ccmsetup\ccmsetup.exe /uninstall
ping 127.0.0.1 -n 60
RD /S /Q c:\windows\System32\ccmsetup
RD /S /Q c:\windows\System32\ccm
rem RD /S /Q c:\windows\System32\ccmcache
echo SCCM Client 2007 removed.
IF EXIST %windir%\SMSCFG.INI GOTO DELINI
GOTO END
:DEL12
echo Found SCCM client v2012. Removing.
c:\windows\ccmsetup\ccmsetup.exe /uninstall
ping 127.0.0.1 -n 60
RD /S /Q c:\windows\ccmsetup
RD /S /Q c:\windows\ccm
rem RD /S /Q c:\windows\ccmcache
echo SCCM Client 2012 removed.
IF EXIST c:\windows\SMSCFG.INI GOTO DELINI
GOTO END
:DELINI
echo SMSCFG file found. Removing...
del /F c:\windows\SMSCFG.INI
echo SMSCFG file removed.
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates\SMS\Certificates
if errorlevel 0 goto DELREG
GOTO END
:DELREG
REG DELETE HKLM\software\Wow6432Node\Microsoft\Systemcertificates\SMS\Certificates /f
echo Registry Key removed.
GOTO END
:END
echo Done!

Define hang? What does the log execmgr.log says?

  • Author

All the other stuff, are the folders, registry keys and INI files that the ccmsetup /uninstall leaves behind.

Found the problem.

The script was running from ccmcache folder that was being deleted by the script itself.

Solution:

Created a script that copies the uninstall script to a temp folder and run if from there.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.