I've created a function to read some WMI objects and a function to set a property on one of the attributes of each object returned from this function. All functions work properly without pipeline input but I want to change that.
I'm assuming if I've got the $InputObject param object type set correctly then the params for the Disable function will be bound to the $InputObject by value. However, I'm consistently getting the error like it's not. I'm trying to use data from a CSV that works if I just use each row of the CSV into the Get cmdlet but whenever I try to pipe that to the Disable cmdlet I get the below error.
I finally figured it out. I originally wanted to exclude all the properties that started with "__" in my Get cmdlet so I was using Select-Object to do that. It was outputting the objects as Selected.System.Management.ManagementObject rather than System.Management.ManagementObject. As soon as I removed that Select-Object from the end and just allowed the default object to come from Get-WmiObject it worked like a champ.