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. Required fields are marked *

about me

An information technology professional with twenty five years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.