Hi,
I have written a powershell script ScriptsImport.ps1 that is part of my NuGet package.
This gets deployed on the destination machine. Once deployed, I want a step to call the powershell script.
I cannot seem to get it to call it. Receiving the following error:
2014-01-23 15:19:06 INFO ERROR: The term ‘.\ScriptsImport.ps1’ is not recognized as the name of a cmdlet, funct
2014-01-23 15:19:06 INFO ERROR: ion, script file, or operable program. Check the spelling of the name, or if a
2014-01-23 15:19:06 INFO ERROR: path was included, verify that the path is correct and try again.
2014-01-23 15:19:06 INFO ERROR: At C:\Users\Administrator\AppData\Local\Tentacle\Temp\2618ba8c-28c9-4059-b9f6-9
2014-01-23 15:19:06 INFO ERROR: 834d83cb937.ps1:1 char:2
2014-01-23 15:19:06 INFO ERROR: + . <<<< .\ScriptsImport.ps1
2014-01-23 15:19:06 INFO ERROR: + CategoryInfo : ObjectNotFound: (.\ScriptsImport.ps1:String) [],
2014-01-23 15:19:06 INFO ERROR: ParentContainsErrorRecordException
2014-01-23 15:19:06 INFO ERROR: + FullyQualifiedErrorId : CommandNotFoundException
2014-01-23 15:19:06 INFO ERROR:
2014-01-23 15:19:06 INFO ==============================================
2014-01-23 15:19:06 INFO PowerShell exit code: 0
2014-01-23 15:19:06 INFO ==============================================
Why am I trying to do this?
I have a single command line application that is used to manage the upgrades of 1000s of databases.
This is installed on each database server and manages the upgrades for that specific database server.
There is a specific order that upgrades must take place, i.e. a “master” database must be upgraded before each
of the customer databases. The console application manages this dependency (would be great if Octopus allowed us to define dependencies between steps). Essentially a different command line is called for each type of database that we need to upgrade.
Therefore in terms of deployment process
- Consolidated upgrade / regression scripts import to “upgrade management” repository takes place on a single box
- Next a powershell script is to run against a single box to upgrade the “master” database
- Next a powershell script is to run against all customer databases (if the master upgrade completed) on a whole host of boxes (determined by a role)
Hope this makes sense. I am not familiar with Powershell although I can confirm my scripts are working when run locally in the Powershell ISE (and to be honest don’t really want to have to be).
Example ps1 script contains the following contents:
$executableDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$executableFilePath = Join-Path $executableDirectory “ForFront.eShot.ManagementUpgrade.Console.exe”
$commandLine = “$executableFilePath” + " -Mode UpgradeDatabases -DatabaseType ‘Customer’ -DatabaseVersion ‘6.0.5582.0’ -RunAgainst ‘.’ /Q"
Write-Host $commandLine
IEX “$commandLine”
Also bandwidth to the production environment from the offices is limited and we therefore want to separate out the deploying of the NuGet packages from their execution. So that we could upload nuget files hours before we are ready to publish the changes.