Windows XP Remove SMS 2003 SP2
Jump to navigation
Jump to search
To remove/scrub the SMS 2003 SP2 client from a PC remotely.
You will need ;
ccmclean.exe
msizap.exe (size:94,720 bytes , there are older versions that don't support every option)
psexec.exe
{{#fileanchor: remove-remote.bat}}
@echo off
COLOR 18
SETLOCAL ENABLEDELAYEDEXPANSION
SETLOCAL ENABLEEXTENSIONS
:start
IF [%1] == [] (
set /p h=Enter Hostname or IP :
) ELSE (
set h=%1
goto main
)
IF [%h%] == [] (
goto start
)
:main
echo Stop services
sc \\%h% stop ccmexec >nul 2>&1
sc \\%h% delete ccmexec >nul 2>&1
echo Copying files
copy /y "%~dp0ccmclean.exe" "\\%h%\c$\temp\" >nul
copy /y "%~dp0msizap.exe" "\\%h%\c$\temp\" >nul
echo Delete files
del /f /s /q "\\%h%\c$\WINDOWS\system32\CCM" >nul
echo delete any psexec service in case version mismatch
sc \\%h% stop psexesvc >nul 2>&1
sc \\%h% delete psexesvc >nul 2>&1
echo Running CCM Clean
rem doesnt always work on first clean, so run it twice
FOR /L %%i IN (1,1,2) DO (
echo Running CCM Clean Try %%i. Please wait this may take a while
psexec \\%h% c:\temp\ccmclean.exe /q /all /retry:5,15 /logdir:"c:\temp"
)
echo Deleting reg keys
rem below keeps track of whats installed and such, if you delete will try and reinstall all software allready installed, bad idea!
rem [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Mobile Client]
reg delete "\\%h%\HKLM\SYSTEM\CurrentControlSet\Services\CcmExec" /f 2>nul
reg delete "\\%h%\HKLM\SYSTEM\CurrentControlSet\Services\CcmFramework" /f 2>nul
reg delete "\\%h%\HKLM\SOFTWARE\Microsoft\SMS\Client" /f 2>nul
reg delete "\\%h%\HKLM\SOFTWARE\Microsoft\SMS\SMS Performance Data Provider" /f 2>nul
reg delete "\\%h%\HKLM\SOFTWARE\Microsoft\SMS\VPCache" /f 2>nul
reg delete "\\%h%\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt\{7ad0c93d-1481-410e-a03f-fcbab39df291}" /f 2>nul
echo Cleaning up with MSIZap
psexec \\%h% c:\temp\msizap.exe TWAP! {83AD5E71-80C0-4818-B6E4-CA2607B6A141} >nul
echo Repairing WMI
rem doesnt always work on first go, so run it twice
rem check log here C:\WINDOWS\system32\wbem\Logs\setup.log
FOR /L %%i IN (1,1,2) DO (
echo Repairing WMI try %%i. Please wait this may take a while
psexec \\%h% rundll32 wbemupgd, UpgradeRepository
)
:reboot
set /p r=Press y to reboot %h%, any other key to end :
IF [%r%] == [y] (
echo Rebooting %h% in 5 seconds
shutdown -r -f -t 5 -m \\%h%
)
:end
echo "Press a key to exit"
pause
[{{#filelink: remove-remote.bat}} remove-remote.bat is now available for download HERE]