Click here to return to the KiXtart HelpDesk main page...

KiXtart Script Depot

Removes MS-SMS 1.2 from Windows NT servers

;
; Kix-script that removes MS-SMS 1.2 from Windows NT servers
; 05.12.1999 - Brian Petersen
;
; Stopping services,
; Deleting files and folders,
; Deleting Registry keys,
; Copies a log file for control,
; Terminates...
;

break on

; Stopping NT-services...
SHELL "%COMSPEC% /C NET STOP INV32CLI"
SHELL "%COMSPEC% /C NET STOP WUSER32"

; Clearing Hidden file attribute...
SHELL "%COMSPEC% /C attrib -h C:\SMS.INI"
SHELL "%COMSPEC% /C attrib -h C:\SMS.NEW"
SHELL "%COMSPEC% /C attrib -h C:\SMSSETUP.LOG"
SHELL "%COMSPEC% /C attrib -h C:\BOOTSTRP.LOG"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\Ismif16.dll"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\Ismif32.dll"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\Wchat32.exe"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\Inv32cli.exe"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\Wuser32.exe"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\Wusermsg.dll"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\Wslave32.exe"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\_wslav32.dll"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\smsrun32.exe"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\_Wchat32.dll"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\_Wuser32.dll"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\System32\drivers\Rchelp.sys"
SHELL "%COMSPEC% /C attrib -h C:\WINNT\System32\drivers\kbstuff.sys"

; Deleting files...
SHELL "%COMSPEC% /C del C:\SMS.INI"
SHELL "%COMSPEC% /C del C:\SMS.NEW"
SHELL "%COMSPEC% /C del C:\SMSSETUP.LOG"
SHELL "%COMSPEC% /C del C:\BOOTSTRP.LOG"
SHELL "%COMSPEC% /C del C:\WINNT\Ismif16.dll"
SHELL "%COMSPEC% /C del C:\WINNT\Ismif32.dll"
SHELL "%COMSPEC% /C del C:\WINNT\Wchat32.exe"
SHELL "%COMSPEC% /C del C:\WINNT\Inv32cli.exe"
SHELL "%COMSPEC% /C del C:\WINNT\Wuser32.exe"
SHELL "%COMSPEC% /C del C:\WINNT\Wusermsg.dll"
SHELL "%COMSPEC% /C del C:\WINNT\Wslave32.exe"
SHELL "%COMSPEC% /C del C:\WINNT\_wslav32.dll"
SHELL "%COMSPEC% /C del C:\WINNT\smsrun32.exe"
SHELL "%COMSPEC% /C del C:\WINNT\_Wchat32.dll"
SHELL "%COMSPEC% /C del C:\WINNT\_Wuser32.dll"
SHELL "%COMSPEC% /C del C:\WINNT\System32\drivers\Rchelp.sys"
SHELL "%COMSPEC% /C del C:\WINNT\System32\drivers\kbstuff.sys"

; and deleting folders...
SHELL "%COMSPEC% /C rd /s /q D:\MS\SMS"
SHELL "%COMSPEC% /C rd /s /q D:\Server~1\Micros~1\sms"
SHELL "%COMSPEC% /C rd /s /q C:\WINNT\Profiles\AllUse~1\StartM~1\Programs\System~1"
SHELL "%COMSPEC% /C rd /s /q C:\WINNT\Profiles\AllUse~1\StartM~1\Programs\SMSCli~1"

; Deleting Registry Keys...
$error = DelTree("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\SMS")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security\SMS Remote Control")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\kbstuff")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\rchelp")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\inv32cli")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuser32")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_KBSTUFF")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_RCHELP")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_SMS_BOOTSTRAP")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_SMS_CLIENT_CONFIG_MANAGER")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_SMS_EXECUTIVE")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_SMS_INVENTORY_AGENT_NT")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_SMS_PACKAGE_COMMAND_MANAGER_NT")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_SMS_SITE_CONFIG_MANAGER")
$error = DelTree("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_WUSER32")

; Genertes control file...
$server = @WKSTA
$dato = @DATE
$tid = @TIME
$kontrolfil = @WKSTA + ".OK"

Open( 3 , "C:\temp\LOG.TXT" , 5 )
$x = WriteLine( 3 , "SMS12 removed from " + $server + " - " + $dato + " - " + $tid + Chr(13) + Chr(10) )
close(3)

SHELL "%COMSPEC% /C ren C:\Temp\LOG.TXT $kontrolfil"

; Sending control file to Administrator...
Use X: "\\MINSERVER\SMSkontrol"
SHELL "%COMSPEC% /C xcopy C:\Temp\" + $Kontrolfil + " X:"
Use X: /delete

; Terminates...
exit