安装 Windows PowerShellInstalling Windows PowerShell

本文内容

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

如果你对 PowerShell 6 及更高版本感兴趣,则需要安装 PowerShell Core 而不是 Windows PowerShell。关于相应的信息,请参阅在 Windows 上安装 PowerShell Core

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

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

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

控制台For Console

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

ISEFor ISE

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

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

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

Windows Server 核心版本Windows Server Core editions

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

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

Windows Server 桌面版本Windows Server Desktop editions

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

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

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

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

升级现有 Windows PowerShellUpgrading existing Windows PowerShell

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

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

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

备注

Windows 10 初始版本中,由于已启用自动更新,因此 PowerShell 会从版本 5.0 更新至 5.1。

如果 Windows 10 原始版本未通过 Windows 更新进行更新,则 PowerShell 版本为 5.0。

需要 Azure PowerShellNeed Azure PowerShell

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

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

另请参阅See Also

Windows PowerShell 系统要求

启动 Windows PowerShell