Quote:

nm... I just moved :RepeatLoop above $server and it works fine.




ACK! a goto! quick, run and hide befor the goto police find YOU!!

Code:

While not $RepeatLoop
$server = "\\GJLK2W3DS101\Logging\"
$folder = "Local_Admin_Password_Log\"
$comp = @WKSTA
$rc = WshPipe("%COMSPEC% /e:1024 /c net user wsadmin /random /passwordchg:yes")
$y = 0

for each $line in $rc
If InSTR($line, "Password for")
While $y = 0
If Exist($server+$folder+$comp+".log") = 1
DEL $server+$folder+$comp+".log"
EndIf
If Open(5,$server+$folder+$comp+".log",5) = 0
$line = SubSTR($line,26,Len($line))
$temp = WriteLine(5,"$comp,$line,"+@TIME+","+@DATE+@CRLF)
$ = Close(5)
$y = 1
Else
$y = 0
Sleep 1
EndIf
Loop
EndIf
If InSTR($line, "The password does not meet the password policy requirements")
$RepeatLoop = 0
Else
$repeatloop = 1
EndIf
next
Loop