Script does not seem to function at all

I placed the PostDeploy.ps1 script in the root directory of my package. The script was to modify a subdirectories permissions to add “Everyone” , set permission level to “FullControl”, set allow\deny to “Allow”. The script never executed and the file was not deleted from the directory after deployment. Nothing worked…

The script is:

$folderPath=($OctopusOriginalPackageDirectoryPath + “\downloads”)
$userName =“Everyone”
$controlLevel=“FullControl”
$allowDeny=“Allow”

Write-Host “FolderPath: $folderPath”
Write-Host “UserName: $userName”
Write-Host “ControlLevel: $controlLevel”
Write-Host “AllowDeny: $allowDeny”

$Acl = Get-Acl $folderPath
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule($userName,$controlLevel,$allowDeny)
$Acl.SetAccessRule($Ar)
Set-Acl $folderPath $Acl
Write-Host “download directory permissions set”

I have set the log-in for the service to an Admin level on the server.
Also, when I execute the script in Powershell everything works great.
With Tentacle, only the user gets created, no permissions get set… I have no clue about making this work…

Any help here would be appriciated…

PostDepoly.ps1 (828 Bytes)

The file name has been fixed.

Changed line to:
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule(“Everyone”,“FullControl”,“ContainerInherit,ObjectInherit”,“None”,“Allow”)

Previous worked but Windows GUI did not correctly reflect the change due to inharatance.
Previous was setting GUI to show Special as permission level…

Self-Solved…

Hi Walter,

I’m sorry for not responding sooner; thanks for sharing your solution and glad you got it resolved.

Paul