Right,this is the first thing I have really tried out, and got messed with the way the thread was handling file redirections together with psexec usage,etc.
So gave it up eventualy...
This is the peace of code I was trying to thread unsuccessfully :
sub getMem {
$main->Update();
my $stationC = shift;
#print STDOUT "HERE3,$stationC\n";
# finding PPS memory
#system("psexec.exe \\\\$stationC -n 10 -u xxxx -p yyyy systeminfo 2>\"$TEMP\\$stationC.1a.err.txt\"|find \"Total Physical\" >>\"$TEMP\\$stationC.memory.txt\"");
system("wmic /NODE:\"$stationC\" /USER:xxxxx /PASSWORD:yyyyyy memlogical list full|find \"TotalPhysicalMemory\" >\"$TEMP\\$stationC.CS.txt\"");
#print STDOUT "HERE4\n";
$STATIONS->{$stationC} =1 unless ($product eq "710DFE");
if ($product eq "710DFE") {
#print STDOUT "HERE5\n";
my @stations = ("pps01","pps02","pps03","pps04","pps05","pps06","pps07","pps08");
for (@stations) {
$main->Update();
#print STDOUT "~~~$stationC.$_\n";
undef $result1;
my $result1 = `"$INSTPATH\\psexec.exe" \\\\$stationC -u xxxxx -p yyyy -n 5 ping -n 1 -w 200 $_ 2>\"$TEMP\\$stationC.$_.ping.txt\"|find "Lost = 0"`;
#Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
if ($result1 =~ /Lost = 0/) {
$main->Update();
print STDOUT "Checking memory on $stationC.$_ ...\n";
$STATIONS->{$stationC}{$_} =1;
open (FILE7,">$TEMP\\wmic.$_.bat");
print FILE7 "start /B cmd /c wmic /output:\"d:\\shared\\$stationC.$_.txt\" /NODE:\"$_\" memlogical list full";
close FILE7;
system("xcopy /y /q \"$TEMP\\wmic.$_.bat\" \\\\$stationC\\d\$\\shared\\ >NUL");
$main->Update();
system("\"$INSTPATH\\psexec.exe\" \\\\$stationC -u xxxx -p yyyy -n 5 \"\\\\$stationC\\d\$\\shared\\wmic.$_.bat\" 2>\"$TEMP\\$station.ping.txt\" >NUL");
select (undef,undef,undef,.20); #sleep .2 seconds
$main->Update();
system("xcopy /y /q \\\\$stationC\\d\$\\shared\\$stationC.$_.txt \"$TEMP\\\" >NUL");
}
unlink "$TEMP\\$stationC.$_.ping.txt";
}
}
}
Long live king Moshiach !