dt667 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to get process information for my windows machine, but one of the processes is returning a null value for the ExecutablePath. However, through Process Explorer I can see the Path, but I'm unsure if PE is getting this information another way. The code works for other processes. My code is below:
use Win32::OLE; my $objWMIService; unless ($objWMIService = Win32::OLE->GetObject("winmgmts:{impersonatio +nLevel=impersonate}!\\\\.\\root\\cimv2")) { print("Could not connect to WMI Service on localhost while attempt +ing to collect a remote item. The error returned was: " . Win32::OLE +->LastError() . "."); } my $colItems; unless($colItems= $objWMIService->ExecQuery("SELECT * FROM Win32_Proce +ss", "WQL",0x10 | 0x20)) #unless($colItems= $objWMIService->ExecQuery("SELECT * FROM Win32_Proc +ess")) { print("Could not extract notification query from WMI Service on lo +calhost . The error returned was: " . Win32::OLE->LastError() . "."); } foreach my $objItem (in $colItems) { if(defined($objItem->{CommandLine}) && ($objItem->{CommandLine} = +~ /^.*[Ss][Mm][Ss][Ss]\.[Ee][Xx][Ee]$/)) { print "#################################################\n"; print "CommandLine: '" . $objItem->{CommandLine} . "'.\n"; print "ExecutablePath: '" . $objItem->{ExecutablePath} . "'.\n +"; print "Name: '" . $objItem->{Name} . "'.\n"; print "Caption: '" . $objItem->{Caption} . "'.\n"; print "#################################################\n"; } }
Output:
perl process.pl ################################################# CommandLine: '\SystemRoot\System32\smss.exe'. ExecutablePath: ''. Name: 'smss.exe'. Caption: 'smss.exe'. #################################################
I expect to see 'ExecutablePath: C:\Windows\System32\smss.exe'. Any help would be greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Windows Process Executable Path is Null
by NetWallah (Canon) on Oct 28, 2013 at 15:27 UTC | |
by dt667 (Acolyte) on Oct 28, 2013 at 17:58 UTC | |
by Anonymous Monk on Oct 29, 2013 at 00:57 UTC | |
|
Re: Windows Process Executable Path is Null
by bulk88 (Priest) on Oct 29, 2013 at 02:39 UTC |