Blog Post

Learning Powershell with Show-Command

,

Years ago I blogged about how I like to use the SSMS scripting feature to learn how to do things. Well now I’m starting to learn Powershell and it turns out there is a GUI here as well that will help me learn to script. At least in a very basic way. For example, if I want to see what parameters are actually available for Get-Help and maybe script out a template to work with then I can do this:

Show-Command Get-Help

Each tab (AllUsersView, DetailedView, Examples etc) is a different set of parameters and will not work together. So you have to pick a tab and stick with it. The first problem I’m running into is that I don’t know what the various parameters mean. I’m going to hit that help button on the top right.

Now I have the window version of the help screen. Which if you look closely at tab list you’ll see is an option for the help command. I can now scroll down and see what my various options are. I’m going to go to the Show-Window tab and pull up the help for the Show-Command cmdlet (inception anyone?).

And then if I hit the Copy button I get the command with the parameters (no abbreviations or aliases) put into the clipboard.

Get-Help -ShowWindow -Name Show-Command

-ShowWindow brings up that nice little window for the help.

-Name is the name of the command I want.

I can of course also just hit the Run button and run the command, but that kind of ruins the purpose of it in my opinion.

Last but not least if I want to see the list of possible Common Parameters I can hit the down arrow at the bottom and expand them. I’m going to check Verbose.

And now when I hit copy I get this:

Get-Help -ShowWindow -Name Show-Command -Verbose

Pretty cool right? This will probably be my most used command over the next few months.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating