Using PowerShell for the First Time

So you want to use PowerShell for the first time and you can’t figure out where to start.  You right-click on a PowerShell script that you downloaded from the internet and you are prompted with a security warning, or maybe you see some error messages and then the PowerShell window disappears.  Here are some simple advice to make sure your first PowerShell expedition is a successful one.

Make sure you are using the latest version of PowerShell

The PowerShell team has a great blog post which lists all available versions of PowerShell and related downloads.  If you are using Windows 7 or Server 2008 R2, you already have PowerShell 2.0 installed, but if you are using a previous OS, you will need to download the most recent version.  As of this posting, the latest production release is v2.0, which requires .Net Framework Version 2.0 to be installed.  It is recommended to install .Net Framework Version 3.5 SP1, as this is required for the Integrated Scripting Environment (ISE) and graphical cmdlets.

Opening the PowerShell console

There are numerous ways to access the PowerShell console (when installed) and I’ll list just a few of them for you here.

  • Taskbar
    • An icon that looks like a blue square with >_ in white lettering
    • Windows 7 and Server 2008 R2 (by default)
  • Start Menu
    • Start > Programs > Accessories > Windows PowerShell > Windows PowerShell
    • Windows XP/Vista/7 and Server 2003/2008/2008R2
  • Windows Explorer
    • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    • Windows XP/Vista/7 and Server 2003/2008


Configure the Execution Policy for PowerShell

Configuring the PowerShell execution policy requires access to a user account that has local administrator rights to the system that you wish to configure.  To begin the process, locate the PowerShell executable at one of the locations listed above, right-click the icon and select ‘Run As Administrator’.  If UAC is enabled, you will be required to accept a security warning.  You should now have a blue PowerShell console with a title of ‘Administrator: Windows PowerShell’.  To see the current execution policy, you can use the Get-ExecutionPolicy cmdlet.  In a default install of PowerShell, the value Restricted will be returned. To change the policy, use the Set-ExecutionPolicy cmdlet. 

For more information on available execution policies and how your system will be affected, you can read the about_Execution_Policies documentation.

4 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. thanks for providing a very informative article. looking further for more write ups.

    www.joeydavila.net

    ReplyDelete
  3. I will keep your new article. I really enjoyed reading this post, thanks for sharing.

    Jenna
    www.imarksweb.org

    ReplyDelete