简体   繁体   English

通过TFS2015远程管理IIS

[英]Manage IIS Remotely through TFS2015

Currently using TFS 2015 update 3 for deployments and I have added "PowerShell on target machine" task, which calls for PowerShell script saved on IIS server to stop website before deployments: 当前使用TFS 2015 Update 3进行部署,我添加了“目标计算机上的PowerShell”任务,该任务要求将IIS服务器上保存的PowerShell脚本在部署前停止网站:

icm -ComputerName $server -ScriptBlock {Import-Module WebAdministration; Stop-Website -Name $app}

with session variables as: $server = abc.xyz.com , $app = DefaultWebSite 会话变量为: $server = abc.xyz.com$app = DefaultWebSite

The error I get is: 我得到的错误是:

The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot validate argument on parameter 'Name'. 正在运行的命令已停止,因为首选项变量“ ErrorActionPreference”或公共参数设置为“停止”:无法验证参数“名称”上的参数。 The argument is null. 参数为空。 Provide a valid value for the argument, and then try running the command again.” 为参数提供有效的值,然后尝试再次运行命令。”

The same script works if I hard code the server & application name. 如果我对服务器和应用程序名称进行硬编码,则可以使用相同的脚本。

使用脚本块时,除非将param与参数列表一起使用,或者将PowerShell与3+版本一起使用using: scope修饰符,否则无法使用脚本作用域中的变量。

icm -ComputerName $server -ScriptBlock {Import-Module WebAdministration; Stop-Website -Name $using:app}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TFS2015版本管理Powershell DSC变量使用 - TFS2015 Release Management Powershell DSC Variable Use TFS2015版本管理在远程计算机上执行Powershell - TFS2015 Release Management Execute Powershell on Remote Machine Powershell如何影响TFS2015中的测试执行 - How Powershell affect test execution in TFS2015 目标机器上的TFS2015 Powershell-在发布过程中设置变量/在远程服务器上找到可用端口 - TFS2015 Powershell on Target Machine - Set a variable in the release process / Find a free port on a remote server TFS2015 vNext Build + PowerShell自定义—异常调用保存:TF215070:构建URI无效 - TFS2015 vNext Build + PowerShell Customization — Exception calling Save: TF215070: The build URI is not valid 通过powershell获取压缩的TFS 2015(vNext)构建输出日志(就像构建后的下载链接一样) - Get zipped TFS 2015 (vNext) build output logs through powershell (just like the download link after the build) Powershell部署IIS和TFS - Powershell Deployment IIS and TFS 如何使用Powershell管理TFS权限 - How to manage tfs permissions with powershell 如何在IIS 8中远程停止/启动应用程序池 - How to remotely stop/start an application pool in IIS 8 如何使用Powershell远程配置IIS? - How to configure IIS remotely using powershell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM