安装 Windows PowerShellInstalling Windows PowerShell

从 Windows 7 SP1 和 Windows Server 2008 R2 SP1 开始,每个 Windows 中默认随附安装有 Windows PowerShell。Windows PowerShell comes installed by default in every Windows, starting with Windows 7 SP1 and Windows Server 2008 R2 SP1.

如果你对 PowerShell 6 及更高版本感兴趣,则需要安装 PowerShell Core 而不是 Windows PowerShell。If you are interested in PowerShell 6 and later, you need to install PowerShell Core instead of Windows PowerShell. 关于相应的信息,请参阅在 Windows 上安装 PowerShell CoreFor that, see Installing PowerShell Core on Windows.

在 Windows 10、8.1、8.0 和 7 中查找 PowerShellFinding PowerShell in Windows 10, 8.1, 8.0, and 7

有时在 Windows 中查找 PowerShell 控制台或 ISE(集成脚本环境)并非易事,因为其位置会随不同的 Windows 版本而发生移动。Sometimes locating PowerShell console or ISE (Integrated Scripting Environment) in Windows can be difficult, as its location moves from one version of Windows to the next.

以下表格应有助于在使用的 Windows 版本中查找 PowerShell。The following tables should help you find PowerShell in your Windows version. 此处列出的所有版本均为发布时的原始版本,没有进行任何更新。All versions listed here are the original version, as released, with no updates.

控制台For Console

版本Version LocationLocation
Windows 10Windows 10 单击左下角的 Windows 图标,键入 PowerShellClick left lower corner Windows icon, start typing PowerShell
Windows 8.1、8.0Windows 8.1, 8.0 在开始屏幕上,键入 PowerShell。On the start screen, start typing PowerShell.
如果位于桌面,请单击左下角的 Windows 图标,键入 PowerShellIf on desktop, click left lower corner Windows icon, start typing PowerShell
Windows 7 SP1Windows 7 SP1 单击左下角的 Windows 图标,在搜索框中键入 PowerShellClick left lower corner Windows icon, on the search box start typing PowerShell

ISEFor ISE

版本Version LocationLocation
Windows 10Windows 10 单击左下角的 Windows 图标,键入 ISEClick left lower corner Windows icon, start typing ISE
Windows 8.1、8.0Windows 8.1, 8.0 在“开始”屏幕上,键入 PowerShell ISE。On the start screen, type PowerShell ISE.
如果位于桌面,请单击左下角的 Windows 图标,键入 PowerShell ISEIf on desktop, click left lower corner Windows icon, type PowerShell ISE
Windows 7 SP1Windows 7 SP1 单击左下角的 Windows 图标,在搜索框中键入 PowerShellClick left lower corner Windows icon, on the search box start typing PowerShell

在 Windows Server 版本中查找 PowerShellFinding PowerShell in Windows Server versions

从 Windows Server 2008 R2 开始,安装操作系统可不包含图形用户界面 (GUI)。Starting with Windows Server 2008 R2, Windows operating system can be installed without the graphical user interface (GUI). 不含 GUI 的 Windows Server 版本名为“核心”版本,包含 GUI 的版本名为“桌面”版本。Editions of Windows Server without GUI are named Core editions, and editions with the GUI are named Desktop.

Windows Server 核心版本Windows Server Core editions

在所有核心版本中,登录到服务器时会显示 Windows 命令提示符窗口。In all Core editions, when you log to the server you get a Windows command prompt window.

键入 powershell 并按“Enter”可在命令提示符会话内启动 PowerShell。Type powershell and press ENTER to start PowerShell inside the command prompt session. 键入 exit 可终止 PowerShell 会话并返回命令提示符。Type exit to terminate the PowerShell session and return to command prompt.

Windows Server 桌面版本Windows Server Desktop editions

在所有桌面版本中,单击左下角的 Windows 图标,键入 PowerShell。In all desktop editions, click the left lower corner Windows icon, start typing PowerShell. 将显示控制台和 ISE 选项。You get both console and ISE options.

上述规则的唯一例外是 Windows Server 2008 R2 SP1 中的 ISE;这种情况下,请单击左下角的 Windows 图标,键入 PowerShell ISE。The only exception to the above rule is the ISE in Windows Server 2008 R2 SP1; in this case, click the left lower corner Windows icon, type PowerShell ISE.

如何检查 PowerShell 版本How to check the version of PowerShell

若要查看已安装的 PowerShell 版本,请启动 PowerShell 控制台(或 ISE),键入 $PSVersionTable,然后按“Enter”。To find which version of PowerShell you have installed, start a PowerShell console (or the ISE) and type $PSVersionTable and press ENTER. 查找 PSVersion 值。Look for the PSVersion value.

升级现有 Windows PowerShellUpgrading existing Windows PowerShell

PowerShell 安装包随附于 WMF 安装程序内。The installation package for PowerShell comes inside a WMF installer. WMF 安装程序版本与 PowerShell 版本一致;不提供 Windows PowerShell 独立安装程序。The version of the WMF installer matches the version of PowerShell; there's no stand alone installer for Windows PowerShell.

如需在 Windows 中更新现有 PowerShell 版本,请使用下表找到要更新至的 PowerShell 版本的安装程序。If you need to update your existing version of PowerShell, in Windows, use the following table to locate the installer for the version of PowerShell you want to update to.

WindowsWindows PS 3.0PS 3.0 PS 4.0PS 4.0 PS 5.0PS 5.0 PS 5.1PS 5.1
Windows 10(参见说明 1)Windows 10 (see Note1)
Windows Server 2016Windows Server 2016
- - - 已安装installed
Windows 8.1Windows 8.1
Windows Server 2012 R2Windows Server 2012 R2
- 已安装installed WMF 5.0WMF 5.0 WMF 5.1WMF 5.1
Windows 8Windows 8
Windows Server 2012Windows Server 2012
已安装installed WMF 4.0WMF 4.0 WMF 5.0WMF 5.0 WMF 5.1WMF 5.1
Windows 7 SP1Windows 7 SP1
Windows Server 2008 R2 SP1Windows Server 2008 R2 SP1
WMF 3.0WMF 3.0 WMF 4.0WMF 4.0 WMF 5.0WMF 5.0 WMF 5.1WMF 5.1

备注

Windows 10 初始版本中,由于已启用自动更新,因此 PowerShell 会从版本 5.0 更新至 5.1。On the initial release of Windows 10, with automatic updates enabled, PowerShell gets updated from version 5.0 to 5.1.

如果 Windows 10 原始版本未通过 Windows 更新进行更新,则 PowerShell 版本为 5.0。If the original version of Windows 10 is not updated through Windows Updates, the version of PowerShell is 5.0.

需要 Azure PowerShellNeed Azure PowerShell

如需要 Azure PowerShell,请先参阅 Azure PowerShell 概述If you're looking for Azure PowerShell, you could start with Overview of Azure PowerShell.

或者,可能需要参阅安装和配置 Azure PowerShellOtherwise, what you might need is Install and configure Azure PowerShell

另请参阅See Also

Windows PowerShell 系统要求Windows PowerShell System Requirements

启动 Windows PowerShellStarting Windows PowerShell