适用于: Office 365 for professionals and small businesses, Office 365 for enterprises, Live@edu
上一次修改主题: 2010-05-18
必须先在计算机上安装和配置 Windows PowerShell 和 Windows 远程管理 (WinRM) 的正确版本,然后才能使用 Windows PowerShell。您必须使用 Windows Management Framework,其中包含 Windows PowerShell v2 和 WinRM 2.0 的正确版本。
如果您的计算机运行的是 Windows 7 或 Windows Server 2008 R2,则不必安装任何版本。Windows Management Framework 已经安装。
如果您的计算机运行的是下列操作系统之一,则可以下载并安装 Windows Management Framework:
-
Windows Vista Service Pack 1 (SP1) 或 Windows Vista Service Pack 2 (SP2)
-
Windows Server 2008 SP1 或 Windows Server 2008 SP2
-
Windows Server 2003 SP2
-
Windows XP SP3
快速入门:
1.从计算机上卸载以前版本的 Windows PowerShell
必须先卸载 Windows PowerShell 的任何现有版本,然后才能安装 Windows Management Framework。
注意 对于 Windows 7 或 Windows Server 2008 R2,不必执行此步骤。
从 Windows Vista 上卸载 Windows PowerShell
-
在“控制面板”的“程序”中,打开“程序和功能”,然后卸载在已安装的程序列表中出现的任何 Windows PowerShell 实例。例如,Windows PowerShell v2 的 Community Technology Preview (CTP) 版本可能显示为 Windows PowerShell (TM) V2。
-
在“任务”下,选择“查看已安装的更新”并卸载在已安装的更新列表中出现的任何 Windows PowerShell 实例。例如,Windows PowerShell V1 可能作为以下某个 Microsoft 知识库文章编号所标识的一个 Windows 更新出现:
-
KB928439
-
KB923569
-
KB928439
从 Windows Server 2008 上卸载 Windows PowerShell
-
启动“服务器管理器”,并转到“功能”。
-
单击“卸载功能”。
-
选择“Windows PowerShell”,并按照指示执行卸载。
-
单击“卸载功能”。
-
在“控制面板”的“程序”中,打开“程序和功能”,然后卸载在已安装的程序列表中出现的任何 Windows PowerShell 实例。
-
在“任务”下,选择“查看已安装的更新”。卸载在已安装的更新列表中出现的任何 Windows PowerShell 实例。
从 Windows Server 2003 和 Windows XP 上卸载 Windows PowerShell
-
在“控制面板”中,打开“添加或删除程序”,然后卸载在已安装的程序列表中出现的任何 Windows PowerShell 实例。
-
在“添加或删除程序”中,选择“显示更新”。卸载在已安装的更新列表中出现的任何 Windows PowerShell 实例。例如,Windows PowerShell V1 可能作为知识库文章编号 KB926139 所标识的 Windows 更新出现。
2.从计算机上卸载以前版本的 WinRM
必须先卸载 WinRM 的任何现有版本,然后才能安装 Windows Management Framework。
注意 对于 Windows 7 或 Windows Server 2008 R2,不必执行此步骤。
从 Windows Vista 或 Windows Server 2008 上卸载 WinRM
-
在“控制面板”的“程序”中,打开“程序和功能”,然后卸载在已安装的程序列表中出现的 Windows 远程管理的任何实例。
-
在“任务”下,选择“查看已安装的更新”。卸载在已安装的更新列表中出现的 Windows 远程管理的任何实例。例如,WinRM 2.0 的 Community Technology Preview (CTP) 可能作为以下某个知识库文章编号所标识的 WindowsRemoteManagement 出现:
-
KB936059
-
KB950099
-
KB936059
从 Windows Server 2003 和 Windows XP 上卸载 Windows PowerShell
-
在“控制面板”中,打开“添加或删除程序”,然后卸载在已安装的程序列表中出现的 Windows 远程管理的任何实例。
-
在“添加或删除程序”中,选择“显示更新”。卸载在已安装的更新列表中出现的 Windows 远程管理的任何实例。例如,WinRM 可能作为知识库文章编号 KB936059 所标识的 Windows 更新出现。
3.安装 Windows Management Framework
-
下载并安装 Windows Management Framework。选择包含 Windows PowerShell v2 和 WinRM 2.0 且应用于您的操作系统、系统体系结构和语言的程序包。
安装 WinRM 和 Windows PowerShell 之后,按照后续步骤中的介绍配置该软件,使其能够正常工作。
注意 如果您的本地计算机受 Microsoft Internet Security and Acceleration (ISA) 服务器保护,则您可能必须在该计算机上安装 Windows 防火墙客户端或配置一个代理服务器,才能将 Windows PowerShell 连接到基于云的服务。有关详细信息,请参阅 Windows PowerShell:管理员常见问题。
4.验证 Windows PowerShell 是否可以运行脚本
-
单击“开始”>“所有程序”>“附件”>“Windows PowerShell”。
-
执行以下操作之一以打开 Windows PowerShell:
-
如果运行的是 Windows Vista、Windows 7 或 Windows Server 2008 R2,请右键单击“Windows PowerShell”并选择“以管理员身份运行”。当出现询问您是否要继续的用户帐户控制提示时,请选择“继续”。
-
如果运行的是 Windows XP 或 Windows Server 2003,请单击“Windows PowerShell”。
-
如果运行的是 Windows Vista、Windows 7 或 Windows Server 2008 R2,请右键单击“Windows PowerShell”并选择“以管理员身份运行”。当出现询问您是否要继续的用户帐户控制提示时,请选择“继续”。
-
运行以下命令:
-
如果返回的值是除
RemoteSigned以外的任何其他值,则必须将该值更改为RemoteSigned。
注意 若将脚本执行策略设置为RemoteSigned,则只能运行在您的计算机上创建的脚本或由受信任的源签名的脚本。
5.验证 WinRM 是否允许 Windows PowerShell 建立连接
-
单击“开始”>“所有程序”>“附件”。
-
执行以下操作之一以打开命令提示符:
-
如果运行的是 Windows Vista、Windows 7 或 Windows Server 2008 R2,请右键单击“命令提示符”并选择“以管理员身份运行”。当出现询问您是否要继续的用户帐户控制提示时,请选择“继续”。
-
如果运行的是 Windows XP 或 Windows Server 2003,请单击“命令提示符”。
-
如果运行的是 Windows Vista、Windows 7 或 Windows Server 2008 R2,请右键单击“命令提示符”并选择“以管理员身份运行”。当出现询问您是否要继续的用户帐户控制提示时,请选择“继续”。
-
在命令提示符下,运行以下命令:
注意 如果 WinRM 服务已在运行,则不必启动它。可以通过运行sc query winrm命令检查 WinRM 服务的状态。
-
在结果中查找值
Basic =。如果此值为Basic = false,则必须将此值更改为Basic = true。
注意 如果您已启动 WinRM 服务并且无需更改Basic值,请运行net stop winrm命令来停止 WinRM 服务。
