|
I am working on a script that connects to a about 3000
machines and first modifies the registry then stops and restarts a service then
moves to the next machine. The problem I have run in to is that the script will
hang on some machines indefinitely. I thought to ping the machines first but
this does not solve the problem because some of the machines answer a ping but
still hang. I am looking for a way to set a time limit of say 5 seconds per
machine so that if the changes can not be made in that amount of time the
script will stop, and go to the next machine. use
Win32::Service; use
Win32::NetAdmin; use
Win32::TieRegistry (Delimiter => '/'); Win32::NetAdmin::GetServers("","",
SV_TYPE_WORKSTATION, \@List); ######################################################################################### foreach $machine
(@List){ if (-e ("\\\\$machine\\c\$\\temp\\LOG.txt")){ unlink ("\\\\$machine\\c\$\\temp\\LOG.txt"); } $nKey= $Registry->{"//$machine/LMachine/Software/KEYA "}; $nKey->{"INFO"}= ["0x00000000","REG_DWORD"]; print "$machine\n"; $sKey= $Registry->{"//$machine/LMachine/Software/KEY1"}; $sKey->{"INFO/"}= { "INFO"
=> {
"/Description"
=> "INFO",
"/PackageDate" => "
"/Status" =>
"Installed",
} }; open(OUT, ">\\\\$machine\\c\$\\LOG.txt"); open(OUT4, ">>machines_updated.txt"); print OUT4 "$machine\n"; Win32::Service::StopService($machine, SERVICE); Win32::Service::StopService($machine, SERVICE); $one
= `rcmd \\\\$machine "c:\\bin\\kill.exe APP.exe"`; print OUT "$one"; Win32::Service::StartService($machine, SERVICE); Win32::Service::StartService($machine, SERVICE); $two
= `rcmd \\\\$machine c:\\progra~1\\ APP.exe`; print OUT "$two"; if(Win32::Service::StopService($machine, SERVICE)){ sleep 10; $three
= `rcmd \\\\$machine instsrv
service REMOVE c:\\winnt\\system32\\APP.EXE`; print OUT "$three"; unlink ("\\\\$machine\\c\$\\winnt\\system32\\APP1.EXE"); unlink ("\\\\$machine\\c\$\\winnt\\system32\\APP2.DLL"); unlink ("\\\\$machine\\c\$\\winnt\\system32\\APP3.INI"); close(OUT); } } Mike Fifield Charles Schwab & Co, Inc. WARNING: All e-mail sent to or from this address will be received by the
Charles Schwab corporate e-mail system and is subject to archival and review by
someone other than the recipient. |
- RE: Getting a machine to time out... Fifield, Mike
- RE: Getting a machine to time out... Aaron Trevena
- RE: Getting a machine to time out... Conor Lillis
- RE: Getting a machine to time out... Timothy Johnson
