just to make sure we're on the same level here are some snippeties of the enable/disable user thingie (whole script is 16Kb, I won't post it unless someone orders)
code:
;...
shell "%ComSpec% /c rcmd \\" + $machine + " net user > " + @scriptdir + "\..\tools\" + @wksta + "_all.txt"
;... count all users listed
$ = open(1,@scriptdir + "\..\tools\" + @wksta + "_all.txt",2)
do
$x = readline(1)
until instr($x,"---")
$x = readline(1)
do
if $x
$u1 = substr($x,1,instr($x," ")-1)
if instr($exceptions,$u1) = 0
$amount = $amount + 1
endif
$x = substr($x,len($u1)+2,len($x))
$x = ltrim($x)
if $x
$u2 = substr($x,1,instr($x," ")-1)
if instr($exceptions,$u2) = 0
$amount = $amount + 1
endif
$x = substr($x,len($u2)+2,len($x))
$x = ltrim($x)
if $x
$u3 = rtrim($x)
if instr($exceptions,$u3) = 0
$amount = $amount + 1
endif
endif
$x = readline(1)
else
$x = readline(1)
endif
else
$x = readline(1)
endif
until instr($x,"The Command")
$ = close(1)
;... dimension and fill the array
$ = open(1,@scriptdir + "\..\tools\" + @wksta + "_all.txt",2)
dim $User[$amount]
do
$x = readline(1)
until instr($x,"---")
$array = 0
$x = readline(1)
do
if $x
$u1 = substr($x,1,instr($x," ")-1)
if instr($exceptions,$u1) = 0
$User[$array] = $u1
$array = $array + 1
endif
$x = substr($x,len($u1)+2,len($x))
$x = ltrim($x)
if $x
$u2 = substr($x,1,instr($x," ")-1)
if instr($exceptions,$u2) = 0
$User[$array] = $u2
$array = $array + 1
endif
$x = substr($x,len($u2)+2,len($x))
$x = ltrim($x)
if $x
$u3 = rtrim($x)
if instr($exceptions,$u3) = 0
$User[$array] = $u3
$array = $array + 1
endif
endif
$x = readline(1)
else
$x = readline(1)
endif
else
$x = readline(1)
endif
until instr($x,"The Command")
$ = close(1)
;... do action for all listed $active = 'YES' or 'NO'
$array = 0
do
shell "%ComSpec% /c rcmd \\" + $machine + " net user " + $User[$array] + " /active:"
+ $active + " > " + @scriptdir + "\..\tools\" + @wksta + ".txt"
if @error = 1
$ = open(1,@scriptdir + "\..\tools\" + @wksta + ".txt",2)
$x = readline(1)
while @error = 0
if instr($x,"successfully.")
$check = 1
$done = $done + 1
color g+/n
select
case $done < 10
at(11,52)$done
case $done > 9 and $done < 100
at(11,51)$done
case $done > 99
at(11,50)$done
endselect
endif
$x = readline(1)
loop
$ = close(1)
if $check
$check = 0
else
$failed = $failed + 1
color r+/n
select
case $failed < 10
at(12,52)$failed
case $failed > 9 and $failed < 100
at(12,51)$failed
case $failed > 99
at(12,50)$failed
endselect
$msgcount = $msgcount + 1
if $msgcount = 3
$msgcount = 0
$msg = $msg + $User[$array] + chr(13) + chr(10)
else
if len($user[$array]) >= 8 and $User[$array] <> "salesmgr" and $User[$array] <> "tmersrvd"
and $User[$array] <> "secretary" and $User[$array] <> "salessup"
$msg = $msg + $User[$array] + chr(9)
else
$msg = $msg + $User[$array] + chr(9) + chr(9)
endif
endif
endif
else
$failed = $failed + 1
color r+/n
select
case $failed < 10
at(12,52)$failed
case $failed > 9 and $failed < 100
at(12,51)$failed
case $failed > 99
at(12,50)$failed
endselect
$msgcount = $msgcount + 1
if $msgcount = 3
$msgcount = 0
$msg = $msg + $User[$array] + chr(13) + chr(10)
else
if len($user[$array]) >= 8 and $User[$array] <> "salesmgr" and $User[$array] <> "tmersrvd"
and $User[$array] <> "secretary" and $User[$array] <> "salessup"
$msg = $msg + $User[$array] + chr(9)
else
$msg = $msg + $User[$array] + chr(9) + chr(9)
endif
endif
endif
color n/b+
$col_now = 15 + ($array * 50 / $amount + 1)
while $col < $col_now
$col = $col + 1
at(20,$col)" "
loop
color w+/n
$percent = 100 * ($array + 1) / $amount
at(22,41)'$percent %'
$array = $array + 1
until $array = $amount
;... display messagebox on error(s)
if $msg
$status = "" + $failed + " of " + $amount + " failed"
color r+/n
at(16,21)" "
at(16,21)$status
$ = messagebox($msg,$status,16,4096)
else
$status = "done"
color g+/n
at(16,21)" "
at(16,21)$status
endif