I am trying to use octopus to do a backup before doing a publish. For this I am defining a step in projects steps options. Step type is run a powershell script. The following script I am passing it and setting the source and destination in variables.
param($source, $destination)
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”
############################################
Variables
sz a -t7z $Destination $Source
########### END OF SCRIPT ##########
Getting following error while running it through octopus.
2013-07-03 12:39:20 INFO Begin script run2013-07-03 12:39:20 DEBUG Running script against tentacle http://test05:10933/2013-07-03 12:39:22 INFO Job successful. Tentacle output follows:2013-07-03 12:39:21 INFO ERROR: Test-Path : Cannot bind argument to parameter ‘Path’ because it is null.2013-07-03 12:39:21 INFO ERROR: At C:\Users\test\AppData\Local\Tentacle\Temp\ead246ed-f184-465e-b798-d97a095b1abe.ps1:8 char:212013-07-03 12:39:21 INFO ERROR: + if (-not (test-path $source)) {throw “$source path does not exists”}2013-07-03 12:39:21 INFO ERROR: + ~~~~~~~2013-07-03 12:39:21 INFO ERROR: + CategoryInfo : InvalidData: ( [Test-Path], ParentContainsErrorRecordException2013-07-03 12:39:21 INFO ERROR: + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCom2013-07-03 12:39:21 INFO ERROR: mand2013-07-03 12:39:21 INFO ERROR:2013-07-03 12:39:21 INFO ==============================================2013-07-03 12:39:21 INFO PowerShell exit code: 02013-07-03 12:39:21 INFO ==============================================
Please guide what I am doing it wrong.