Question 01: Is this considered to be a hashtable?
No: you're explicitly creating a string array ([string[]]
), which means that the [pscustomobject]
instances emitted by Select-Object
, based on the [System.Diagnostics.Process]
instances that Get-Process
outputs, are stringified.
A stringified [pscustomobject]
uses a hashtable-like representation that is unrelated to actual hashtables - see this answer.
Note:
This is a for-display, string representation that is not suitable for programmatic processing, notably because information about the data types of properties and boundaries around string property values with spaces are lost.
For that reason, in general, avoid dealing with string representations of objects in favor of processing objects as-is, which enables robust, property-based access.
Question 02: How can I get the values of a key such as MainWindowTitle?
Use the [System.Diagnostics.Process]
objects output by Get-Process
as-is, which allows you to access their properties (no need for an intermediate Select-Object
call); the following example uses member-access enumeration to retrieve all .MainWindowTitle
property values:
(Get-Process Explorer).MainWindowTitle
Question 03: How would I filter on ID field ending with 68?
Building on the above, using Where-Object
with simplified syntax for filtering:
Get-Process Explorer | Where-Object ID -like *68