"Start" PowerShell Command not running in Octopus

I have a library step:

if ($ErrorOnNonExist -eq "False") {
	Write-Host "Looking for [$BinaryPath]"
    $pathFound = Test-Path $BinaryPath
    
    if (!$pathFound) {
    	Write-Host "File not found: [$BinaryPath]"
        return
    }
}

Write-Host "Starting [$BinaryPath]"
Start $BinaryPath

I have the step pointing to an existing executable, and correctly finding said executable, but when the “Start” command runs, nothing happens. This does, however, work when I run it locally on the machine:

Start "C:\Program Files (x86)\Folder\SomeFile.exe"

From another post I found on the Octopus forum I saw that I should test the command out by running it in the way Octopus runs it, so I did:

powershell.exe -Command "& Start 'C:\Program Files (x86)\Folder\SomeFile.exe'"

And this also runs fine on the machine. Any idea why when it runs on Octopus it doesn’t error out nor open up the application?

Hi Jose,

Thanks for getting in touch! I’m sorry about the confusion here. That’s certainly strange as I would expect it to provide an error/warning message of some kind. We’ve recently (in version 2019.10.12) added support for Set-PSDebug -trace to help debug PowerShell scripts (reference issue here). If possible, would you be willing to add that in to your script and perform another deployment to see if that provides more information?

Feel free to send us through the resulting task log and I’ll be happy to have a look. To ensure privacy of the log, feel free to mark this thread as private or email it to us at support@octopus.com and I can get it there. :slight_smile:

I hope this helps and I look forward to hearing back!

Best regards,

Kenny