다음을 통해 공유


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 is 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 here's 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 SP3/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.

Note: Every Windows operating systems from Win XP SP 3 has PowerShell. To check your PowerShell version just try below command. If nothing pops up then you are in PowerShell Version 1.0

001
$PSVersionTable

An easy way to find the PowerShell version.

See Also