Unable to execute powershell cmdlet's in Octopus Server

I'm following the instructions in this article to deploy changes with Octopus server and powershell scripts.

I was previously able to do deployments using the built in components so the SQL Change Automation components are installed and working.

I was hoping that by going the powershell route the deployment may be faster.

I also followed this article to install the components in powershell.

I confirmed I can run the cmdlets in my windows session. But whenever I try a deployment through Octopus I get the following error.

New-DatabaseReleaseArtifact : The term 'New-DatabaseReleaseArtifact' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
At C:\Octopus\Applications\Testing\AcumenDB\2018.12.07.1222_7\Octopus.Action.CustomScripts.PreDeploy.ps1:16 char:1 
+ New-DatabaseReleaseArtifact -Target $targetDatabase ` 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo          : ObjectNotFound: (New-DatabaseReleaseArtifact:Str  
   ing) [], ParentContainsErrorRecordException 
    + FullyQualifiedErrorId : CommandNotFoundException 

I even tried installing the modules for all users:
Install-Module SqlChangeAutomation -Scope AllUsers -AcceptLicense -Force

I also tried running Octopus server with my same user account that I initially installed the modules initially via powershell...

How can I get these recognized in Octopus deploy?

Tagged:

Best Answer

  • Sergio RSergio R Posts: 610 Rose Gold 5
    Please note that you need to install these on the Tentacles that you are using for the release process.
    Apart from that I would suggest that you try installing using the installer that comes with the SQL Toolbelt (you can download this by logging into your account at www.red-gate.com)
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
Sign In or Register to comment.