标题:[PS] HOWTO: 在 Windows Server 2012 上启用 PowerShell Web Access 出处:gOxiA=苏繁=SuFan Blog 时间:Wed, 09 Oct 2013 12:27:26 +0000 作者:gOxiA 地址:https://goxia.maytide.net/read.php/1696.htm 内容: Windows PowerShell Web Access(PSWA)是 Windows Server 2012 中的新功能,充当 Windows PowerShell 网关,允许远程计算机基于 Web 方式(HTTPS)访问和操作目标计算机的 Windows PowerShell,以执行 PowerShell 命令和脚本,而且无需在客户端上安装 PowerShell、远程管理软件或浏览器插件。其角色有些像 Remote Desktop Gateway,且允许单机应用,并且支持工作组环境。 PowerShell Web Access 基于 Web 方式访问的,只要支持 JavaScript 和接受 Cookies 的浏览器基本都可访问操作。下面是整理出的一组浏览器兼容性测试的结果数据,参考微软官方。 受支持的台式计算机浏览器: IE 8、9、10、11 Firefox 10.0.2 Chrome 17.0.963.56m Safari 5.1.2 经过最小限度测试的移动设备或浏览器 Windows Phone 7、7.5、8 Google Android WebKit 3.1 Browser Android 2.2.1 (Kernel 2.6) iPhone 5.0.1 的 Safari iPad 2 5.0.1 的 Safari 为工作组环境下的 Windows Server 2012 安装和配置 PowerShell Web Access 可参考下列步骤: 首先,通过“服务器管理器”的“添加角色和功能”向导安装“Windows PowerShell Web 访问”。使用 PowerShell 命令行安装:“Install-WindowsFeature WindowsPowerShellWebAccess -IncludeManagementTools” 然后,在 PowerShell cmdlet 下执行“Install-PswawebApplication”,以在 IIS 下创建其所需的 Web 应用程序。 注:前面提到 PowerShell Web Access 基于 Web 方式访问,并且使用的是 HTTPS 协议,所以需要为其准备一张证书,否则我们可以通过附加“-UseTestCertificate”创建一个自签名证书,该证书有效期为90天。 如果准备有其他证书,可通过 IIS 管理器对 Web 站点的绑定进行设置。 接下来,需要使用“Add-PswaAuthorizationRule”为 PowerShell Web Access 配置授权规则。例如: “Add-PswaAuthorizationRule –ComputerName * –UserName “maytidesufan” –Configuration *” 其中“-ComputerName”是要授权通过 PowerShell Web Access 访问的计算机名称,也可使用“ComputerGroupName”指定一个计算机组;“-UserName”即允许访问的用户,而“UserGroupName”为用户组;“-Configuration”即允许的会话配置。 现在,我们便可打开浏览器访问 PowerShell Web Access,进行计算机管理。 参考资料:“部署 Windows PowerShell Web 访问”、“使用基于 Web 的 Windows PowerShell 控制台” Generated by Bo-blog 2.1.1 Release