Hello,
I have this Powershell script running inline in Self Hosted Octopus instance on Windows:
Remove-Item "C:\inetpub\wwwroot\plover" -Recurse
But it gives the following error when run:
PermissionDenied: You do not have sufficient access rights to perform this operation.
September 16th 2021 16:10:57Error
At C:\Octopus\Work\20210916231052-6217-112\Script.ps1:6 char:1
September 16th 2021 16:10:57Error
+ Remove-Item "C:\inetpub\wwwroot\plover" -Recurse
September 16th 2021 16:10:57Error
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
September 16th 2021 16:10:57Error
at <ScriptBlock>, C:\Octopus\Work\20210916231052-6217-112\Script.ps1: line 6
September 16th 2021 16:10:57Error
at <ScriptBlock>, <No file>: line 1
September 16th 2021 16:10:57Error
at <ScriptBlock>, C:\Octopus\Work\20210916231052-6217-112\Octopus.FunctionAppenderContext.ps1: line 185
September 16th 2021 16:10:57Error
at <ScriptBlock>, C:\Octopus\Work\20210916231052-6217-112\Bootstrap.Octopus.FunctionAppenderContext.ps1: line 1440
September 16th 2021 16:10:57Error
at <ScriptBlock>, <No file>: line 1
September 16th 2021 16:10:57Error
at <ScriptBlock>, <No file>: line 1
September 16th 2021 16:10:57Error
Cannot remove item C:\inetpub\wwwroot\plover\.git\objects\0d\c7032c9163839de8078e917fba9505bad75938: You do not have sufficient access rights to perform this operation.
September 16th 2021 16:10:57Fatal
The remote script failed with exit code 1
September 16th 2021 16:10:57Fatal
The action Copy release to wwwroot on the Octopus Server failed
How do I fix this? Apologies I just started using Octopus but am still a novice.
I added
Write-Host -ForegroundColor Green "$(whoami)"
to the script to see the current user its running as and it printed out:
nt authority\system
How do I fix this permission issue? Thanks a lot!
System information:
Windows Server 2016
Octopus Deploy Version 2021.2.7462
Execution Location: Run on Octopus Server