Perl, WMI remote process
From: Saadat Saeed (saadat_saeed_at_yahoo.com)
Date: 04/28/04
- Next message: James Edward Gray II: "Re: s/// Vs tr///"
- Previous message: Remo Sanges: "Re: How to change @INC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 28 Apr 2004 05:54:49 -0700 (PDT) To: beginners@perl.org
observe the code way below.... I need to apply these
patches on my remote machines by starting remote
processes on my client machines.
Now or i do
$objWMIService->Create("c\:\\temp\\MS04-012\.exe
\/passive \/norestart") or die("die die die");
it outputs as die die die
why?
and how do I get the processid of what has been
started on the remote machine... i know this can do
this via WMI but how do you implement this in perl
like
create(process,something,something,processid(output))
regards
use Win32::OLE;
use File::Copy;
#use Win32::FileOp;
$machinelist = "comp";
#$log = "log.txt";
open(ML,"$machinelist") or die "Cannot open file
$machinelist : $!";
#open(EL, ">> $log") or die "can't open $log: $!"
while($line = <ML>){
chomp $line;
print("$line\n");
$objWMIService =
Win32::OLE->GetObject("winmgmts:\\\\$line\\root\\cimv2\:Win32_Process")
or die "oops\n";
copy("MS04-011.exe","\\\\$line\\c\$\\temp\\MS04-011\.exe")
or die("unable to copy");
copy("MS04-012.exe","\\\\$line\\c\$\\temp\\MS04-012\.exe")
or die("unable to copy");
#Error = objWMIService.Create("notepad.exe", null,
null, intProcessID)
#print("$Error\n");
$process=$objWMIService->Create("c\:\\temp\\MS04-011\.exe
\/passive \/norestart");
print("$process\n");
$objWMIService->Create("c\:\\temp\\MS04-012\.exe
\/passive \/norestart");
#print("$Error\n");
}
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
- Next message: James Edward Gray II: "Re: s/// Vs tr///"
- Previous message: Remo Sanges: "Re: How to change @INC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|