Mike Sowerbutts
Mike Sowerbutts

Reputation: 35

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

I keep getting this error when the VSTS Release Definition task "Run SQL Server Scripts" is executed:

[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.

I have:

I must be missing some kind of config, but I don;t know what it is!

Any help much appreciated...

Upvotes: 1

Views: 1190

Answers (1)

chris castle
chris castle

Reputation: 154

You can always use powershell for this something like..

$content = Get-Content -Path "testsqlFile.sql" | Out-String Invoke-Sqlcmd -ServerInstance some-ip-address -Database database-name -Username user-name-Password password -Query $content

Upvotes: 1

Related Questions