So, is the
-InputObjectparameter broken? Not really, but we need to be aware of the logic behind it.
Maybe we are used to work with
-ComputerNamefor a lot of cmdlets and functions, and we rely blindly upon the ability of the command to handle whatever collection we provide. We know this executes the action we chose, like
Get-DbaOperatingSystemor whatever, separately to every computer in the collection. The collection is ‘fold out’, ‘unpacked’, ‘split’.
-InputObjectdoesn’t do that! Is that wrong? Not necessarily, it may be a choice of design to have possibilities to enquire the properties of the collection itself and those of the ‘members’ or ‘children’. It’s just a surprise the behaviour differs from pipeline input to parameter input.
Something to keep in mind when writing Powershell scripts.