安装 Windows PowerShell

从 Windows 7 SP1 和 Windows Server 2008 R2 SP1 开始,每个 Windows 中默认随附安装有 Windows PowerShell。

如果你对 PowerShell 7 及更高版本感兴趣,则需要安装 PowerShell 而不是 Windows PowerShell。 有关详细信息,请参阅在 Windows 上安装 PowerShell

在 Windows 11、10、8.1、8.0 和 7 中查找 PowerShell

有时在 Windows 中查找 PowerShell 控制台或集成脚本环境 (ISE) 并非易事,因为其位置会随不同的 Windows 版本而发生移动。

以下表格应有助于在使用的 Windows 版本中查找 PowerShell。 此处列出的所有版本均为发布时的原始版本,没有进行任何更新。

控制台

版本 位置
Windows 10、11 单击 Windows 图标(Windows 10 左下角,Windows 11 底部居中),开始输入 PowerShell
Windows 8.1、8.0 在开始屏幕上,键入 PowerShell。
如果位于桌面,请单击左下角的 Windows 图标,键入 PowerShell
Windows 7 SP1 单击左下角的 Windows 图标,在搜索框中键入 PowerShell

ISE

版本 位置
Windows 10、11 单击 Windows 图标(Windows 10 左下角,Windows 11 底部居中),开始输入 ISE
Windows 8.1、8.0 在“开始”屏幕上,键入 PowerShell ISE 。
如果位于桌面,请单击左下角的 Windows 图标,键入 PowerShell ISE
Windows 7 SP1 单击左下角的 Windows 图标,在搜索框中键入 PowerShell

在 Windows Server 版本中查找 PowerShell

从 Windows Server 2008 R2 开始,安装操作系统可不包含图形用户界面 (GUI)。 不含 GUI 的 Windows Server 版本名为“核心” 版本,包含 GUI 的版本名为“桌面” 版本。

Windows Server 核心版本

在所有核心版本中,登录到服务器时会显示 Windows 命令提示符窗口。

键入 powershell 并按“Enter” 可在命令提示符会话内启动 PowerShell。 键入 exit 可关闭 PowerShell 会话并返回命令提示符。

Windows Server 桌面版本

在所有桌面版本中,单击左下角的 Windows 图标,键入 PowerShell。 将显示控制台和 ISE 选项。

上述规则的唯一例外是 Windows Server 2008 R2 SP1 中的 ISE;这种情况下,请单击左下角的 Windows 图标,键入 PowerShell ISE。

如何检查 PowerShell 版本

若要查看已安装的 PowerShell 版本,请启动 PowerShell 控制台(或 ISE),键入 $PSVersionTable,然后按“Enter” 。 查找 PSVersion 值。

升级现有 Windows PowerShell

PowerShell 安装包随附于 WMF 安装程序内。 WMF 安装程序版本与 PowerShell 版本一致;不提供 Windows PowerShell 独立安装程序。

如需在 Windows 中更新现有 PowerShell 版本,请使用下表找到要更新至的 PowerShell 版本的安装程序。

Windows PS 3.0 PS 4.0 PS 5.0 PS 5.1
Windows 11
Windows Server 2022
- - - 已安装
Windows 10(参见说明 1)
Windows Server 2016
- - - 已安装
Windows 8.1
Windows Server 2012 R2
- 已安装 WMF 5.0 WMF 5.1
Windows 8
Windows Server 2012
已安装 WMF 4.0 WMF 5.0 WMF 5.1
Windows 7 SP1
Windows Server 2008 R2 SP1
WMF 3.0 WMF 4.0 WMF 5.0 WMF 5.1

备注

Windows 10 初始版本中,由于已启用自动更新,因此 PowerShell 会从版本 5.0 更新至 5.1。 如果 Windows 10 原始版本未通过 Windows 更新进行更新,则 PowerShell 版本为 5.0。

需要 Azure PowerShell

如需要 Azure PowerShell ,请先参阅 Azure PowerShell 概述

或者,可能需要参阅安装和配置 Azure PowerShell

另请参阅

Windows PowerShell 系统要求

启动 Windows PowerShell