PowerShell automation for Windows Server 2008

Windows PowerShell allows for great productivity and efficiency by automating certain administrator tasks across a system. Get this platform up and running in three easy steps.

Windows PowerShell is quickly becoming a sought after skill set. A management platform designed by Microsoft, PowerShell 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

Environment Install directions

Windows 2008

PowerShell ships as a
feature on Windows
2008. To install
PowerShell, simply
add the feature
(see figure 1.)

Vista, Windows 2003, Windows XP

Double-click the file
downloaded previously
and step through the
wizard. This will install
PowerShell in
PowerShellv1.0 and
add the appropriate

Installing PowerShell in Windows Server 2008
Figure 1 Installing PowerShell in Windows 2008. (Click on image for enlarged view.)

Step 3: Configure
Following a successful PowerShell installation, three basic features need to be configured to get the most bang for your buck.

Execution Policy

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:

  1. Restricted: No scripts will run (default).
  2. AllSigned: Only digitally signed scripts by a trusted CA will run.
  3. RemoteSigned: Scripts downloaded from the Internet Zone will need to be signed. All other scripts will run.
  4. 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:

  1. The global location, which affects all PowerShell sessions
  2. 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

Command Use
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:

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.

Dig Deeper on Application virtualization and streaming

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.

Automate folder on the build share; from there they are copied to the VM as it’s built. Copying the scripts locally helps avoid PowerShell prompting about running from an untrusted location C:\PSFunctions.ps1