How can you test if an object has a specific property?

Solution 1:

Like this?

 [bool]($myObject.PSobject.Properties.name -match "myPropertyNameToTest")

Solution 2:

You can use Get-Member

if(Get-Member -inputobject $var -name "Property" -Membertype Properties){
#Property exists
}