Hi Guy,
To dynamicly select properties of an input object regarding the PowerShell cmdlet that he will be used in. I needed a way to list cmdlet properties.
Therefor I started looking in the Microsoft Get-Command cmdlet, and I found some intersting properties.
[ps](Get-Command -Name $Cmdlet).Parameters.Keys[/ps]
It gave me the entire list of parameters available for the wanted cmdlet.
But it gave me to mutch informations, the return values included, for example: ErrorVariable, Verbose,??WhatIf or Debug. Which are not really interesting to be used as Pipeline input or splatting. In the purpose of removing those not wanted parameters I did the following:
[ps](Get-Command -Name $Cmdlet).Parameters.Keys | Where-Object { @(”) -notmatch $_ }[/ps]
Here is an example with the Office 365 Cmdlet New-MsolUser: