1
votes

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:

  • Checked the username/password I am using have Administrator privileges (it isnt using a domain)
  • Ensured WinRM service is running (on the Build Server, and on the Target Server)
  • Ensured the remote server is accessible via WinRM in Powershell console using WinRM quickconfig, which gives me back:

    • WinRM service is already running on this machine.
    • WinRM is already set up for remote management on this computer.
  • Disabled the firewall on the Target server (i also tried adding firewall exception for the appropriate IP etc. too to the Windows Remote Management rule)

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

Any help much appreciated...

1
I end up using this book to help me in troubleshooting Remoting problems: leanpub.com/secretsofpowershellremoting - thom schumacher
> isn't using a domain. Why? - Maximilian Burszley
Try to run powershell remotely on that target server manually and check the result: howtogeek.com/117192/… - starian chen-MSFT

1 Answers

1
votes

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