in reply to Re^2: SEQUENTIAL REBOOT ORDER WINDOW$
in thread SEQUENTIAL REBOOT ORDER WINDOW$
sub getDOS { print "This is dollar 0 $_[0]\n\n"; open TASK, "$_[0] 2>&1|" or die "cannot open pipe to DOS"; my @return; while (<TASK>) { #chomp; #chop; #print; #return $_; push @return, $_; } return @return; } foreach (@servers){ my $externalExe = qq(psexec.exe \\\\$_ -u ); $externalExe .= $dev_cred . " -p "; #$externalExe .= $prod_pass . ' -i -d cmd /c shutdown /r /f /t 0'; $externalExe .= $dev_pass . ' ipconfig'; print "\n\n... Program START: \n\n $externalExe \n \n"; my @output = getDOS($externalExe); print "\n\nReturned output from DOS command:\n"; foreach(@output){ print; die if $_ =~ /$[Ee]rror/; die if $_ =~ /[Ii]nvalid/; } #wmic process call create "cmd /C > C:\temp\test.txt 2>&1 netstat. +exe -ano" #PsExec v2.2 - Execute processes remotely #Copyright (C) 2001-2016 Mark Russinovich #Sysinternals - www.sysinternals.com #The handle is invalid. #Error communicating with PsExec service on PR0235IPRT002: #print for qx|$externalExe 2>&1|; # Executes the program, and prin +ts it's output print "\n\n.... run complete ...\n"; sleep 360; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: SEQUENTIAL REBOOT ORDER WINDOW$
by 3dbc (Monk) on Feb 08, 2018 at 21:40 UTC |