Is there a simple way to test if a property exists on a given object under PoSH 3?
I have a number of cmdlets which return objects with alternate sets of properties, depending on their results. In my scripts, I’d like to test for the existence of those properties within if statements, but PoSH returns errors on the property not existing. This has been a long running frustration that I Google for every couple of months to no avail. The only options seem to involve convolutions around try/catch blocks or writing helper functions that parse through the properties on objects. Both of those approaches potentially meet my functional requirements, but it seems like an awful lot of code and scaffolding for a simple -exists style function. Is there a simpler PoSH method to meet this goal? How do others solve what I would think would be a common problem?