Windows PowerShell is quickly becoming a sought after skill set. A management platform designed by Microsoft, PowerShell...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
allows administrators to automate tasks resulting in greater productivity and efficiency. Download, install and configure PowerShell in the following three easy steps.
Step 1: Download PowerShell
Unless you are running Windows 2008, Windows 7 or Windows 2008 R2 you will need to download PowerShell before you can get started: Download PowerShell here.
Step 2: Install
PowerShell ships as a
Vista, Windows 2003, Windows XP
Double-click the file
Step 3: Configure
Following a successful PowerShell installation, three basic features need to be configured to get the most bang for your buck.
By default, PowerShell will not run any scripts and the file association (for .PS1) is set to notepad. These are security measures that Microsoft implemented to protect you. There are four security levels:
- Restricted: No scripts will run (default).
- AllSigned: Only digitally signed scripts by a trusted CA will run.
- RemoteSigned: Scripts downloaded from the Internet Zone will need to be signed. All other scripts will run.
- Unrestricted: All scripts will run. You will still get prompted for "Internet Zone" scripts.
For more information: get-help about_Execution_Policies
Profiles are like the autoexec.bat for PowerShell; they are used to setup the environment with customizations. There are two main locations for profiles:
- The global location, which affects all PowerShell sessions
- User specific and stored in the user's profile -- there is a default variable called $Profile that contains the path to the user's profile.ps1 file
|For more information: get-help about_profile|
One of the most common uses of a profile is to create a custom prompt. Every time a command is executed, a function called prompt is called. It is possible to overwrite this function with your own version. While this is useful, be careful -- remember, it gets called every time you run a command; therefore, you need to keep it simple and quick.
|For more information: get-help about_prompt|
Useful Commands in PowerShell
|Get-Help||This cmdlet provides help for any cmdlet. If you want to know what a cmdlet does and how to use it… this is your guy!|
|Get-Command||This cmdlet will return a list of commands that PowerShell can use. By default it lists cmdlets and functions.|
|Get-PSSnapin||This cmdlet will return a list of loaded snap-ins. If you want to see all snap-ins available use the -register parameter.|
|Get-Member||This cmdlet will list all the members an object has to offer. You can use this to find out what properties and methods to use on the object returned from a cmdlet.|
For free PowerShell scripts and more PowerShell information and news, I suggest checking out the following websites:
- Scripting with Windows PowerShell
- The PowerShell Community: "Increasing the awareness and usage of Windows PowerShell."
- BSonPoSH -- The "Power" of SHELL blog
- PowerShell code repository
ABOUT THE AUTHOR:
Brandon Shell has been in the IT industry since 1994. He started out as a PC tech and general fix-it guy for numerous companies. In 2000, he joined Microsoft as contractor for the Directory Services team (the first of several times) until he became a full-time employee in 2002. In 2004, he left Microsoft to pursue a new position focusing on his real passion, PowerShell. In 2007 he joined the PowerShell MVP ranks and spent the last several years building his PowerShell knowledge and helping others build theirs.