Reference PowerShell Object Properties Dynamically Including Spaces and Special Characters

June 3, 2020

Referencing a PSObject property with special characters is pretty easy:

$var = $psobject."Property With Space"

In order to reference properties that include special characters dynamically:

$propertyname = "Property With Space"
$var = $psobject.($propertyname)


Leave Your Comment

Your email address will not be published.

about me

An information technology professional with twenty three year's experience in systems administration, computer programming, requirements gathering, customer service, and technical support.