3.1 - File System permissions script failing

Once of my deployments uses a Grant Permissions script from the Octopus library (https://library.octopusdeploy.com/#!/step-template/actiontemplate-file-system-grant-permissions). Since upgrading to Octopus 3.1, this step is failing with some rather odd errors:

Method invocation failed because [System.Security.Cryptography.AesCryptoServiceProvider] doesn’t contain a method named Dispose’.
At C:\Octopus\Work\20150918141944-42\Bootstrap.Script.ps1:87 char:19+ $provider.Dispose <<<< () + CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound

Any ideas what might be causing this?

Hi James,

Thanks for reaching out. Was that script working on that exact same Tentacle before 3.1? What version of Powershell and the .NET framework is that machine running? If unsure, run this snippet on the machine

gci 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' |
sort pschildname -des                                  |
select -fi 1 -exp pschildname -OutVariable dotnet | Out-Null

Write-Output ".Net version: $dotnet"
Write-Output "Powershell version: $($PSVersionTable.Psversion)"

Thanks!

Dalmiro

I had a very similar error in my logs during my deployment…

I was using 2.6 and the same deployment worked with out any errors…

Once I upgraded to 3.1 and attempted the same deployment I got the following error…

Method invocation failed because [System.Security.Cryptography.AesCryptoService
13:32:37Error
Provider] doesn’t contain a method named ‘Dispose’.
13:32:37Error
At C:\Octopus\Applications\Latestbuild_DBUP_ControlDB\5.13.530.0\Bootstrap.Dep
13:32:37Error
loy.ps1:87 char:19
13:32:37Error

  • $provider.Dispose <<<< ()
    

13:32:37Error
+ CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeEx
13:32:37Error
ception
13:32:37Error
+ FullyQualifiedErrorId : MethodNotFound
13:32:37Error
13:32:37Error
Array assignment to [Octopus.Action[WebServicesDeploy].IISWebSite.ApplicationPo
13:32:37Error
olPassword] failed: The value “********” is not of type “System.S
13:32:37Error
tring” and cannot be used in this generic collection.
13:32:37Error
Parameter name: value…

I ran the above script and this is the output from my Octopus Server.

.Net version: v4.0
Powershell version: 3.0

Regards,

Rudy

Hi Dalmiro

Output of your script is below:

.Net version: v4.0
Powershell version: 2.0

Hi,

This error is occurring on Tentacles running PowerShell 2.0. We will look to get a fix out as soon as possible, but in the meantime if you are able to upgrade to PowerShell >= 3.0 on the Tentacle, it should fix the issue.

Sorry for the inconveniences

Thanks Dalmiro,

the server of the tentacle which had the error only had Powershell 2.0 install. I upgraded this to Pwoershell 3.0 and then redeployed and the deployment was successful without any errors.

Regards,

Rudy

Hi Dalmiro

The release notes for 3.1.1 suggest this may have been fixed:

“2005 - Resolved issue with PowerShell 2.0 and sensitive-variables”

Was this fix related to what we have discussed in this thread? If so, I’ve upgraded to 3.1.1 and I’m still getting the issue on deployments.

Hi James,

The fix was related to what we discussed here, yes. I’ve passed on your comment to the dev that worked on this issue. I’ll keep you posted.

Thanks,

Dalmiro