0

I'm trying to retrieve __PATH property in WQL query.

When I trying to enumerate it using WSMAN and WQL query, it returns only ProcessId .

Get-WSManInstance -Enumerate wmicimv2/* -filter "SELECT __PATH, ProcessId FROM Win32_Process"

But it is easy to make sure that __PATH is not null.

Get-WmiObject -Query "SELECT __PATH, ProcessId FROM Win32_Process"  -Namespace root/cimv2 

Why it is not possible to retrieve WMI System Properties (like __PATH) in enumeration request?

John
  • 454
  • 2
  • 5
  • 18

1 Answers1

1

__PATH is WMI-specific metadata.

A path (in WMI terminology) is a URL-like resource identifier that helps you locate a specific object.

WSMan does not share that concept, but describes resources by referencing a ResourceURI (or class name, in your case wmicimv2/Win32_Process), and one or more key selectors to distinguish a unique instance. The "path", as such, are really contained in these two pieces of information:

PS C:\> (Get-WSManInstance wmicimv2/Win32_Process -SelectorSet {Handle = 4}).Caption
System
Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
  • you have to add @ to {Handle = 4} – John Nov 04 '15 at 07:43
  • I have asked this question on microsoft forum and received same question https://social.msdn.microsoft.com/Forums/en-US/38ce6e82-cbe5-44c7-98c5-9dc8a8701e9f/wsman-and-wmi-system-properties?forum=os_windowsprotocols – John Dec 04 '15 at 13:45
  • @John absolutely right, typo on my part. Please suggest an edit – Mathias R. Jessen Dec 04 '15 at 14:00