Powershell command not working

I have a very basic database script file. i’m using a powershell command to execute it.
The command is this: SQLCMD -S databaseServerName -d shelby -i “c:\teamCity\buildAgent\dbBuildScript.sql” -E
When i run the command in powershell it executes no problem.
It’s the second step of a deploy process. (the first step deployes a nuget package from teamcity - and this steps works fine.)
I’m working on my local machine only - both teamcity and octopus deploy are installed there.

Any ideas?

Not getting much from the Octopus error log:
The step failed
16:46:27Fatal
A step failed
16:46:27Fatal
One or more items in the current operation failed.
17:02:24Fatal
One or more items in the current operation failed.
17:02:24Fatal
One or more items in the current operation failed.
17:02:24Fatal
The step failed
17:02:24Fatal
A step failed
17:02:24Fatal

Happy to provide additional details as needed.
Thanks,
Steve

Hi Steve,

Would you be able to send (redacted as necessary) the raw log from the task status page, after the deployment has failed? You can get this from a link at the top right.

If you can send more detail of the content of the script step (or the script file, if it is a Deploy.ps1-style script) that would also help.

Regards,
Nick

Nick,
Nice. I didn’t know to look there.
That’s a big help right there. It can’t find the script file.

Maybe you could give a quick description of how you would do this.
I’m unsure about how to make that file available for Octopus Deploy to find.

I’ve attached the script file. It’s very basic.
Thanks for the quick reply.

Sqlcmd: Error: Error occurred while opening or operating on file c:\teamCity\buildAgent\dbBuildScript.sql (Reason: The system cannot find the path specified).
17:25:36
Info

17:25:36
Info
PowerShell exit code: 1
17:25:36
Info

17:25:36
Fatal
PowerShell script returned a non-zero exit code: 1

dbBuildScript.sql (363 Bytes)

Hi Steve,

Since the SQL script is a versioned artifact, the best way to approach this is probably to use a Package step.

You can use NuGet.exe to “pack” both the script, and a Deploy.ps1 file, into a .nupkg file. If you do this as part of your TC build it will be automatically published.

There’s a lot more info on using Octopus to deploy SQL server databases here: http://docs.octopusdeploy.com/display/OD/SQL+Server+databases - it is worth trying out some of these approaches if you have the opportunity.

Regards,
Nick

Nick,
I’ll read the documentation and experiment with the approaches.
Thanks for your help and advice.

Steve