uninstalls
del user accts
del profile folders
tested only on win2k (the only hardcoded path is C:\Documents and Settings\)
Code:
; ****************************** Uninstall SMS Client ******************************************
if exist('%SMS_LOCAL_DIR%\ms\sms\core\bin\clicore.exe')
? ' Removing SMS Client. Please wait (up to 3-5 minutes)...' ?
Shell "cmd /c "+$setup+"\smsclientclean\20CLICLN.BAT /scrub"
? ' Removing SMS User Accounts...'
$oDomain = GetObject("WinNT://"+@wksta)
$oUser = $oDomain.Delete("user", 'SMSCliSvcAcct&')
$oUser.SetInfo
$oUser = $oDomain.Delete("user", 'SMSCliToknAcct&')
$oUser.SetInfo
? ' Removing SMS Profile folders...'
$fs=CreateObject("Scripting.FileSystemObject")
for each $folder in FolderList('C:\Documents and Settings','smsc')
$fo=$fs.GetFolder("C:\Documents and Settings\"+$folder)
$fo.Delete("true")
next
endif
Function FolderList($folderName,optional $mask)
dim $objDir, $objFld, $objFile, $t, $name
$objDir = CreateObject('Scripting.FileSystemObject')
if @error Exit 1 Endif
$objFld = $objDir.GetFolder($folderName).SubFolders
if @error exit 2 endif ; usually folder not found
For Each $objFile In $objFld
$name=$objFile.name
if ($mask and instr($name,$mask)) or not $mask
$t=$t+'|'+$name
endif
Next
$FolderList=split(substr($t,2),'|')
$objDir = 0
EndFunction