I am trying to run the following script using the Powershell DBAtools module to export to a CSV file all my Databases size. From the server the script works fine, but using Octopus, all I can get is the
Databases names, but without their size. Does anyone know how to solve this or have any other idea to get the DB size through Octopus?
Thanks for getting in touch! At first glance, I would guess that the issue is due to a difference in user accounts when connecting to the database. It appears you’re using integrated authentication, so when you’re running it, its running as you, but when Octopus runs it, it runs as the service account that Octopus is setup under.
If that’s not the case, as this appears to be a DBAtools issue, I would recommend raising an issue over on their github repository.
You could try using the special variables Octopus.Action.PowerShell.Username and Octopus.Action.PowerShell.Password . While not explicitly designed for this scenario, that may work to set the user to use when running your script.