【发布时间】:2014-12-08 06:18:51
【问题描述】:
我正在尝试使用运行 Powershell 命令的 MSBuild 脚本部署 Windows 服务。
MSBuild 脚本部署我需要的文件,PowerShell 脚本将使用以下命令卸载并重新安装 Windows 服务:
Invoke-Command -ComputerName IPAddressHere -FilePath "C:\theScriptFileName.ps1" -credential "TheUserName"
使用 IP 地址(由于域不同,我需要这样做)我需要使用凭据。问题是它提示输入密码,这对 TeamCity 的自动化不起作用。
我知道我可以将凭据保存到一个变量中,这样提示就不会显示,但我需要将它放入 MSBuild 可以执行的如下行:
powershell.exe -NonInteractive -executionpolicy Unrestricted -command "& Invoke-Command -ComputerName IPAddressHere -FilePath 'C:\theScriptFileName.ps1' "
有没有合适的方法来做到这一点?
【问题讨论】:
标签: powershell msbuild teamcity credentials