Implementation of the code,Erroe:use Win32; use Win32::OLE; #$machine= shift || Win32::NodeName(); my $machine="WH2851030605387"; #The office of another PC $class = "WinMgmts:{impersonationLevel=impersonate}!//$machine"; + $wmi = Win32::OLE->GetObject($class); $plist = $wmi->InstancesOf("Win32_Process"); $~ = PROC_LIST; write; $~ = PROC_INF; $n = 0; foreach $Proc (Win32::OLE::in( $plist )){ write; $n++; } print " ===========================\n"; print " -> Processes number : $n <-\n"; print " ==========================="; # -------------------------------------------------------------------- +--------- format PROC_LIST = @||| @|||||||||||||||| @||||||| "PID", "Process Name", " Memory" ---- ----------------- -------- . format PROC_INF = @<<< @<<<<<<<<<<<<<<<< @<<<<<<< $Proc->{'ProcessID'},$Proc->{'Name'}, $Proc->{'PeakWorkingSetSize'} .
C:\Documents and Settings\lisuzhong\Desktop>perl -w procList.txt
Win32::OLE(0.1707) error 0x800706ba: "RPC " after character 0 in "WinMgmts:{impersonationLevel=impersonate}!//WH2851030605387" at procList.txt line 8
eval {...} called at procList.txt line 8 Can't call method "InstancesOf" on an undefined value at procList.txt line 9. ------------------------------------------
Above,should be how do we solve this?
Thanks.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |