sacaliabu Posted January 4, 2016 Report post Posted January 4, 2016 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! Quote Share this post Link to post Share on other sites More sharing options...
ZeZe Posted January 5, 2016 Report post Posted January 5, 2016 Define hang? What does the log execmgr.log says? Quote Share this post Link to post Share on other sites More sharing options...
GarthMJ Posted January 5, 2016 Report post Posted January 5, 2016 I will bite, why do you think it hang? Why are you doing anything more than CCMsetup /uninstall? aka what is with all the other stuff? Quote Share this post Link to post Share on other sites More sharing options...
sacaliabu Posted January 5, 2016 Report post Posted January 5, 2016 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. Quote Share this post Link to post Share on other sites More sharing options...
ZeZe Posted January 5, 2016 Report post Posted January 5, 2016 ahah! 1 Quote Share this post Link to post Share on other sites More sharing options...