Get Parameter

As I continue to work on the 2nd edition of Managing Active Directory with Windows PowerShell: TFM, I find situations where I need a tool to get information out of Windows PowerShell. For example, the cmdlets in the Microsoft Active Directory module have a lot of parameters and I wanted to know some specifics. Now I could simply keep reading the full cmdlet help, but that gets kind of tedious. Instead I remembered I can use the Get-Command cmdlet to dig into the details.

For example, here are the parameters for Get-Service.

The value, System.Management.Automation.ParameterMetadata is intriguing. The output is a dictionary object so I can check just a single parameter.

I can even take it a step further and get attribute information.

Now that I know where to go and how to get what I need, I can write a function to retrieve parameters for a given cmdlet or function.

The function has comment based help and examples so be sure to take a look. Otherwise the function is pretty straight forward. I use it with an alias, gpa.

I’m sure it needs a few tweaks so let me know what works and what doesn’t.  You can download Get-Parameter.ps1 here.

One thought on “Get Parameter”

Comments are closed.