Powershell Issues with Octopus Deploy

Hi,

OCTOPUS VERSION = 3.3.24

I have a nuget package that holds database bapacs and powershell scripts that restore the database to an azure instance. However, the following command raises an error in octopus, the same script runs with no errors from the powershell command shell.

command that causes error:
$sqlpassword = ConvertTo-SecureString ‘YFlBoS7yYXXXXXXXXXXXXXXXXSxqKE96rcqGI4u0LqflPg8mEPgl67DiBr7J9M’ -AsPlainText –Force

Error:

ConvertTo-SecureString : Cannot convert ‘System.String’ to the type
’System.Management.Automation.SwitchParameter’ required by parameter ‘Force’.
At C:\Octopus\Work\20160804112813-79\DrugUpdate-SetupSourceData.ps1:12 char:118

  • … cOhAlKTMxIBSxqKE96rcqGI4u0LqflPg8mEPgl67DiBr7J9M’ -AsPlainText ?Force
  •                                                                ~~~~~~
    
    • CategoryInfo : InvalidArgument: (:slight_smile: [ConvertTo-SecureString], P
      arentContainsErrorRecordException
    • FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Comma
      nds.ConvertToSecureStringCommand

The remote script failed with exit code 1

Need help.

Hi Suraj,

Thanks for reaching out. That exact command worked on my lab actually.

  • Is this failing on all the machines its being executed on?

  • Which version of Powershell are the failing machines running?

Regads,
Dalmiro