Good one !!! [Razz]

I was doing this task in my company now, I made a (vulger) script to do it, It look mess but it is doing so many checks, If you can add those checks in ur script it would be wonderfull, I'll post my code here, may be u'll get some idea out of that.

code:
 
$computerlist=NetView2()
For Each $computer In $computerlist
;? ''+$computer

$PRODUCTTYPE=ReadValue('\\'+$computer+'\HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\PRODUCTOPTIONS','PRODUCTTYPE')
If $PRODUCTTYPE="WinNT"
$regkey='\\'+$computer+'\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
$regvalue='CurrentVersion'
If ReadValue($regkey,$regvalue)='5.0'
Use t: "\\$remotepc\c$"
Sleep 2
If @error=0
;? "U have admin privilage"
$wm=ping ("$computer",1)
$Len=Len("$wm")
$NWA=SubStr($wm,4,$Len-8)
$POS=InStr($NWA,".")
$NAP=SubStr($NWA,1,$POS-1)
$NA=LTrim("$NAP")
If($na="2" OR $na="23" OR $na="24")
$regvalue1=KeyExist('\\'+$computer+'\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFIx\KB823980')
If $regvalue1=0
? "$cOMPUTER dosent have Hotfix"
Shell "%comspec% /c xcopy /Q /e /Y /i \\w2k0182\Patch \\$computer\c$\patch\"
Copy "d:\patch\patchdel.bat" "\\$computer\c$"
WriteValue ('\\'+$computer+'\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce',"delfolder",'c:\patchdel.bat','REG_SZ')
$name=patchinstall.job
$comp='$computer'
$date=TODAY
$time=NOW
$type=ONCE
$cmd='c:\patch\update.exe'
$prms='-q -z -n'
$user=admin
$pw=password
$comment='patch deployment'
$typeargs=''
$rc=scheduletask($name,$comp,$date,$time,$type,$cmd,$prms,$user,$pw,$comment,$typeargs,$jt)
Open(1,"C:\patchinstall.TXT",5)
WriteLine (1,"$computer scheduled for patch install"+@CRLF)
Close(1)
; copy service pack to local machine
; schedule local machine install via Task Scheduler
Else
? "$computer patch allready installed"
EndIf
Else
? "$computer is not in target subnet"
EndIf
Use t: /Del
Else
? "you dont have admin privilage in $computer"
EndIf
Else
? "$computer is either not Windows 2000 or is offline"
EndIf
Else
? "$computer is server"
EndIf
Next

I am using netview2 to deploy the patch only to pingable machines.
_________________________
“I’ll not change you unless you don’t have intention to change yourself” --H:Quran