Prof. Powershell

Getting Started with PowerShell 3.0

Baby-stepping into new PowerShell territory.

Windows PowerShell 3.0 is just around the corner. If you've downloaded one of the Windows 8 previews, you've been able to kick version 3 around. Or you can download a beta candidate from Microsoft.

PowerShell is actually just one piece of the Windows Management Framework that will also include remoting technologies such as WinRM and Windows Management Instrumentation (WMI), which has a few enhancements of its own. More on those in future columns.

If you are installing 3.0 on Windows 7 or Windows Server 2008, at a minimum you'll need .NET Framework 4.0 installed. There may be a few other requirements, so be sure to check the notes on the download site. We're still pre-RTM so things might change.

Once installed, one of the first things you will want to do -- actually need to do -- is update help. PowerShell 3.0 ships with updateable help, which really means it ships with no help. You will need to open an elevated PowerShell prompt and need Internet access. Then you can run the Update-Help cmdlet:

PS C:\> Update-Help

By default you can only run this once a day, unless you use -Force. But this should download all the necessary help. The next thing you will want to do is look at $PSVersionTable, where you can verify the version:

PS C:\> $PSVersionTable

Name                       Value
----                       -----
PSVersion                  3.0
WSManStackVersion          3.0
SerializationVersion       1.1.0.1
CLRVersion                 4.0.30319.17379
BuildVersion               6.2.8250.0
PSCompatibleVersions       {1.0, 2.0, 3.0}
PSRemotingProtocolVersion  2.2

The next new feature you will want to explore is Show-Command. If you run it without any parameters:

PS C:\> show-command

you'll get a graphical listing of all available commands (see Fig. 1).

PowerShell 3 Show-Command

Figure 1. Show-Command. (Click image to view larger version.)

You can click one and then Show Details to learn more. Or you can show a specific command (see Fig. 2):

PS C:\> Show-Command get-service

PowerShell 3 Show-Command get-service

Figure 2. Show-Command get-service. (Click image to view larger version.)

What's nice is that you can fill out the dialog box and click Run to execute the command or click Copy to copy the command line expression to the clipboard. This is a great way for building complex commands.

The last step you want to do in your first few minutes is to read about PowerShell's new features:

PS C:\> help about_Windows_PowerShell_3.0

At some point when you are looking for a more complete reference, I hope you'll track down a copy of PowerShell In Depth from Manning Press, which I'm co-writing with fellow MVPs Don Jones and Richard Siddaway.

PowerShell 3.0 will have an even greater impact on how IT pros do their jobs. Prof. PowerShell will likewise be devoting more lessons to the latest version, especially as RTM nears.

Note: This information is based on the latest publicly available pre-release version of PowerShell 3.0. Expect some changes with the final, shipping release.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus
Most   Popular