Learn about Windows PowerShell
Summary: Microsoft Scripting Guy, Ed Wilson, talks about discovering Windows PowerShell 3.0 cmdlets.
Microsoft Scripting Guy, Ed Wilson, is here. There are still a few tickets available for Windows PowerShell Saturday in Charlotte, North Carolina on September 15, 2012. The agenda includes sessions about Active Directory, SharePoint, Exchange Server, Windows 8, in addition to beginner and advanced Windows PowerShell sessions. This is a great chance to learn about Windows PowerShell from world class speakers, meet fellow Windows PowerShell enthusiasts, and fill your contact lists with excellent resources. Yep—networking at a Windows PowerShell Saturday event is always exceptional, and this event will prove to be another opportunity to meet new friends and to make important Windows PowerShell contacts.
You may want to take the survey that was put out by the community group organizing the next Windows PowerShell Deep Dive in Redmond, Washington at the Microsoft Campus in April 2013. This is a great chance to make your voice heard.
One of the things I really like about Windows PowerShell 3.0 (in general—not necessarily in Windows 8) is that it is more discoverable than previous versions of Windows PowerShell. Now, don’t get me wrong. Even Windows PowerShell 1.0 was highly discoverable. In fact, the same three cmdlets you used then still work: Get-Help, Get-Command, and Get-Member. They are still the most basic cmdlets you will use. However, there is now a new one now. Show-Command is the name of the new cmdlet. You do not pipe a cmdlet to the Show-Command cmdlet. This generates an error (as illustrated here when I piped the Get-Process cmdlet to Show-Command).
To use the Show-Command cmdlet, you can specify the name of the cmdlet to Show-Command when calling it. This technique is shown here.
Show-Command -Name Get-Process
When you do this, the Show-Command window appears, and the Windows PowerShell console pauses until you close the Show-Command window or you specify parameters for the cmdlet. In the example shown here, I add a process name to the Show-Command window prior to pressing Run to run the command.
After the Run button is pressed, the Show-Command window closes, and the created Windows PowerShell command is written to the Windows PowerShell console. Then the command executes, and the results appear in the console. This is illustrated in the image shown here.
Another way to use the Show-Command cmdlet is to simply launch the Show-Command window. It details all the commands from all modules. To explore commands from a specific module, select it from the Modules drop-down list. This works even for custom modules. In the image shown here, I select my WMI module, and it displays all of the advanced functions that are contained in that module.
If I want to, I can choose one of the commands, and the dialog changes to display the parameters from the command. I can then run the command, or copy the command that gets created.
Keep in mind that I was demonstrating how to use this useful tool from within the Windows PowerShell console, but it also exists in the new and improved Windows PowerShell ISE.
That is about it for today, join me tomorrow for more Windows PowerShell cool stuff.
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at email@example.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy