
close
close
Upcoming FREE Conference on Identity Management and Privileged Access Management
So you’ve finally gotten the memo and decided it was time to start learning PowerShell. Excellent. But before you go off searching YouTube for free training videos or simply start floundering around at a PowerShell prompt, which will frustrate you to no end, take a moment to lay out the groundwork.
Although PowerShell isn’t something that you can master in 24 hours, you can learn enough in a short period of time to accomplish some simple and basic tasks. This article is aimed at the absolute PowerShell beginner running at least PowerShell 3.0 on a Windows 7 desktop. For beginners, the fundamentals of PowerShell don’t change between versions 3, 4, or 5.
To start, I recommend launching PowerShell in an elevated session. Even if your account has admin rights, some of the things you will need to do will require an elevated session. Find the PowerShell console icon on your Start Menu, right-click and choose the ‘Run as Administrator’ option. PowerShell should now open in the traditional blue screen.
An elevated PowerShell session (Image Credit: Jeff Hicks)
Using traditional commands in Windows PowerShell. (Image Credit: Jeff Hicks)
The next thing you might want to do is to identify what version of PowerShell you are running. At a prompt, type $psversiontable, and press Enter. What you just typed is a built-in variable that shows you version information about the different components of the Windows Management Framework. PowerShell is actually just one piece.
The PowerShell version table (Image Credit: Jeff Hicks)
The first major step you need to take in the first 30 minutes is to update PowerShell’s help files. This requires Internet access. Out of the box, PowerShell ships with minimal help documentation. All you need to do is type the command Update-Help and press Enter. The command will search your computer for all PowerShell commands and check them for online links for downloadable help.
Updating PowerShell help (Image Credit: Jeff Hicks)
Update-Help –force
The next step is to begin familiarizing yourself with all of the great help documentation you just downloaded. Start out by running this command:
help about_windows_Powershell*
I used a wildcard because you might see different topics depending on your version. You will probably get a list of matching items.
Listing about topics (Image Credit: Jeff Hicks)
help about_windows_powershell_4.0
About Windows PowerShell (Image Credit: Jeff Hicks)
PowerShell also has help for all the commands you will be using. Remember when I said typing dir isn’t the same as the DIR command you may be used to? Ask PowerShell for help:
Help dir
You should see something like this.
Help for the dir command (Image Credit: Jeff HIcks)
dir c:\windows\softwaredistribution –recurse
By default PowerShell displays a short version of help. You can read full command documentation with the –Full parameter.
Help dir –full
Many commands also have a link to an online version of help, which is sometimes more up-to-date than what you can download. To see the latest version of help, use the –Online parameter.
Help dir -online
Get in the habit of reading help all the time, even for commands you think you know. New versions of PowerShell might add a new parameter or feature, and unless you read the help, you’ll miss out.
Hopefully you still have a few minutes left to dip your toe in the PowerShell waters. Try running a few basic commands:
Again, don’t feel you have to completely understand what these commands are doing or how they work. I want you to see how easy it is to use PowerShell. If you want to learn more about the commands read their help documentation.
Learning PowerShell is no different than learning a foreign language. It will be rough at first and might feel like an epic struggle, but stick with it. Master the basics like you would any language before diving into more complex scenarios and topics.
I strongly encourage you to find ways to use PowerShell every day. Even if you do nothing other than read a new help topic. The more you use it, the more you’ll understand it, which means it will get easier, and you’ll want to use it more.
At this point, you can start searching for other educational sources, although I certainly hope you’ll stay connected with the content I write for Petri. I also maintain a page on my own blog with my suggestions for PowerShell resources.
Welcome to an exciting new world. Let’s get started.
More in PowerShell
Most popular on petri