Bit late this, but never mind.
How will the pure KiX soloution remove special folders such as the recyclebin? As far as I can see it only deletes the profiles sub folder for a user.
Although it's a nice bit of code I just don't think it will work as well as delprof.
I use :
Code:
;===============================================================================================
; delprof.kix
; Last Modified on 21/01/04 at 13:59:52 by acmp
;===============================================================================================
;tidy up profiles on remote PC
;Change Log:-
;21/1/04 Set exit to be when no information is entered rather than prompt and Loop
;21/1/04 Put logging into main IF loop so that it only applies when the process runs OK
Break on
;splash
Big
Color w+/n
?" DelProf!"
Sleep(1)
;Header
Small
CLS
Box(1,1,10,40,"double")
At(2,9)"Profile tidyup by acmp"
At(3,9)"======================"
Color w/n
At(5,4)"Enter a PC name to tidy up."
At(6,4)"This program uses delprof from the"
At(7,4)"NT RES Kit, located in efolders"
At(8,4)"Results are logged in delprof.log"
At(11,1)
:Loop
?"Enter the PC name you wish to tidy (Or [Return] to quit)"@CRLF
Gets $pc
If Asc($pc)<>0
;If $pc<>asc(0)
$pc=Trim($pc)
$free=pipe("dir \\$pc\admin$")
For Each $line In $free
If InStr ($line,"bytes free")
?Trim($line) +" Before delprof"
$splitted=Split(Trim($line)," ",1)
For Each $element In $splitted
$before=$element
Next
EndIf
Next
$status=Pipe("\\server13\efolders\delprof.exe /q /i /c:\\$pc")
For Each $line In $status
?$line
Next
$free=pipe("dir \\$pc\admin$")
For Each $line In $free
If InStr ($line," bytes free")
?Trim($line) +" After delprof"
$splitted=Split(Trim($line)," ",1)
For Each $element In $splitted
$after=$element
Next
EndIf
Next
$entry=$pc+",'"+$before+"','"+$after+"',"+@USERID
writelog2("\\server13\netapps\KixLogs\delprof.log",$entry,1)
Else
Exit
EndIf
?""
?"done"
GoTo("Loop")
Function pipe($command)
;$array = pipe("net users") ; load output of net users into an array
;$array = pipe("dir c:\*.ini /s /b") ; load a listing of all ini files into an array
;$array = pipe("type config.txt") ; load the contents of a text file into an array
;$ipconfig = pipe('ipconfig /all | find "Server"')
;For Each $line In $ipconfig
; ? $line
;Next
Dim $i,$error,$line
Dim $array[255]
Dim $ReDim $ReDim = Ubound($array)
Dim $tempfile $tempfile = "%temp%\pipe.tmp"
If Exist("$tempfile")
Del("$tempfile")
EndIf
If @inwin = 2 ; win9x
Shell '%comspec% /c $command >"$tempfile"'
Else ; winnt
Shell '%comspec% /c $command >"$tempfile" 2>nul'
EndIf
$error=@error
If Open(10,"$tempfile") = 0
$i=0
$line = ReadLine(10)
While NOT @error
If $line
$array[$i] = $line
If $i = $ReDim
$ReDim=$ReDim*2
ReDim preserve $array[$ReDim]
EndIf
$i=$i+1
EndIf
$line = ReadLine(10)
Loop
$=Close(10)
Del "$tempfile"
If $i > 0
ReDim preserve $array[$i-1]
$pipe=$array
Else
$pipe = 0
EndIf
Exit $error
Else
$pipe = 0
Exit @error
EndIf
EndFunction
Function WriteLog2($File, $Text, optional $TimeStamp)
;WriteLog2($File, $text, [0|1])
Dim $RC, $File, $text, $FH, $TimeStamp
$FH=1
$RC=Open ($FH, $File, 5)
While $RC = -3
$FH=$FH +1
$RC=Open ($FH, $File, 5)
Loop
Select
Case $RC=0
If ($TimeStamp=1)
$TimeStamp = "," +@Date + "," + @Time
Else
$TimeStamp = ""
EndIf
$RC=WriteLine ($FH, $Text + $TimeStamp+ @CRLF)
$RC=Close ($FH)
Case $RC=-2
$text = "WriteLog2: Invalid file handle ($FH) specified when trying to Open $File."
;$RC=MessageBox ($text,"Script Error",48)
Case $RC=-1
$text = "WriteLog2: Invalid file name ($File) specified for log file."
;$RC=MessageBox ($text,"Script Error",48)
Case $RC=>0
$text = "System Error($RC) while attempting to open log file ($File)."
;$RC=MessageBox ($text,"Script Error",48)
EndSelect
EndFunction
I have it packaged with KixStart and just run it from a shortcut and it is brill.
acmp<><