Incorrect command line while running a powershell script

The following script was working fine but suddenly it comes up with the following error message.

Execute step BackupFolderToServer against machine Test05
2013-07-10 11:19:25 INFO Begin script run2013-07-10 11:19:25 DEBUG Running script against tentacle http://test05:10933/2013-07-10 11:19:28 ERROR Running job on the tentacle failed:2013-07-10 11:19:28 INFO Tentacle output follows:2013-07-10 11:19:27 INFO Error:2013-07-10 11:19:27 INFO Incorrect command line2013-07-10 11:19:27 INFO ==============================================2013-07-10 11:19:27 INFO PowerShell exit code: 72013-07-10 11:19:27 INFO ==============================================2013-07-10 11:19:27 ERROR Octopus.Shared.Activities.ActivityFailedException: PowerShell script returned a non-zero exit code: 7 at Octopus.Tentacle.Services.Jobs.Script.ScriptJobExecutor.Execute(ScriptJob job, JobState state) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Services\Jobs\Script\ScriptJobExecutor.cs:line 52 at Octopus.Tentacle.Services.Jobs.JobQueue.RunDeploymentsOnBackgroundThread(Object ignored) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Services\Jobs\JobQueue.cs:line 81

Don’t know how to figure out what is the problem as error message is not very clear. Please guide.

Hi,

  • Octopus is calling your PowerShell script.
  • Your powershell script must be calling a command line tool (I’m not sure what)
  • The command line tool writes “Incorrect command line” and returns exit code 7
  • Octopus fails the deployment because your script returns a non-zero exit code

Without knowing what your script looks like it’s hard to guess what might be causing the error.

Paul

Sorry, missed attaching the script. Following is the script which was working fine.

Get the date

$DateStamp = get-date -uformat “%Y-%m-%d@%H-%M-%S”
$destination = “$destination-$DateStamp”

#Check source dir exists or not
if (-not (test-path $source)) {throw “$source path does not exists”}

Alias for 7-zip

if (-not (test-path “C:\Program Files\7-Zip\7z.exe”)) {throw “C:\Program Files\7-Zip\7z.exe needed”}
set-alias sz “C:\Program Files\7-Zip\7z.exe”
“I am here before variables”
############################################

Variables

sz a -t7z $Destination $Source
"I am here after zip"
########### END OF SCRIPT ##########