我想部署一個Windows服務使用MSBuild腳本運行Powershell命令。MSBuild與憑據調用Powershell
的MSBuild的腳本部署文件,我需要和PowerShell腳本將卸載,並使用此命令重新安裝Windows服務:
調用命令-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'」
有沒有適當的方法來做到這一點?