无法从构建服务器通过 Powershell/WinRm 连接到远程服务器

Can't connect to remote server via Powershell/WinRm from Build Server

执行 VSTS 发布定义任务 "Run SQL Server Scripts" 时,我不断收到此错误:

[error]System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server [MY DATABASE SERVER IP HERE] failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.

我有:

我一定是缺少某种配置,但我不知道它是什么!

非常感谢任何帮助...

你总是可以使用 powershell 来做这件事,比如..

$content = 获取内容路径 "testsqlFile.sql" |外弦 Invoke-Sqlcmd -ServerInstance some-ip-address -Database数据库名-用户名用户名-密码密码-查询$content