Jump to content


sacaliabu

SCCM Client uninstalll script hangs.

Recommended Posts

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.