I am currently running a PowerShell script to execute some report deployments, which originally used a .cmd file to initiate. Both the .cmd file and PowerShell file work when run locally by hand, however, when executed via Octopus I repeatedly get the error:
Could not connect to server: http://localhost/ReportServer/ReportService2005.asmx
Powershell Script is as follows:
$ScriptRoot = "E:\Octopus\Applications\ATE\Reports\2.20.9000.29"
& “C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\rs.exe” -i $Reports -s “localhost/ReportServer” -v currentPath=$ScriptRoot -v reportFolder=“Reports_Octopus” -v dbServer=“DATABASE” -v dbPassword=“PASSWORD”
Any ideas why executing the script via Octopus may be causing the connection to fail?
Thanks for getting in touch!
I suspect what is happening here is that the account that Octopus is executing the script under doesn’t have the required permissions to access the resource (either the executable or the database itself). By default Octopus Server (and Octopus Tentacles) run under the Local System account. To confirm that this is the case I would make sure that the script is executing on a Tentacle (you can safely install the Tentacle agent on your Octopus server if required); then change the account that the Tentacle is running under to one that has the required permissions.
This can be done by following the instructions located here: https://octopus.com/docs/installation/installing-tentacles/running-tentacle-under-a-specific-user-account-for-use-in-powershell
I hope this assists, if you have any other questions or require further assistance please don’t hesitate to get in touch,
Thanks for the help, that was indeed the problem. I figured it out soon after posting the question, as is usually the case!
Thanks for letting me know that all is well! I’m glad to hear that I’m not the only one who figures out the answer only after asking the question