Copy-Item from local storage to UNC is throwing error "Access Deny"

iginzburg's Avatar

iginzburg

21 Aug, 2017 11:56 PM

Greetings,
 I am working on ClickOnce deployment. In the very last step I need to copy *\bin\Release\app.publish|\**\*.* into UNC path.
The command I am using is Copy-Item -Path $source -Destination $target -Force -PassThru -Verbose.
$target is \\UNC\something\somthing. I am getting "Access is denied"
"
Copy-Item : Access is denied
At C:\Octopus\Work\20170821235000-610\Script.ps1:29 char:1
"
 According to command [System.Security.Principal.WindowsIdentity]::GetCurrent().Name the script and deployment for this matter runs by NT AUTHORITY\SYSTEM

My question is how to run "Create Publish URL" step by [email blocked] ID? or how to fix "Assess is denied"?

Inna

  1. Support Staff 1 Posted by Alex Rolley on 22 Aug, 2017 04:31 AM

    Alex Rolley's Avatar

    Hi Inna,

    Thanks for getting in touch!

    What appears to be happening here is that the account that is executing your powershell doesn't have enough permissions to access the network path. By default Octopus Tentacles execute powershell with the local System account, which is what your error logs are reporting.

    Can you please confirm that you are executing this powershell script on a Tentacle (and not your Octopus Server)? If this is the case then I would recommend changing the user account that your Tentacle is running as, which can be done by following these instructions. If you need to execute the script on the Octopus server itself I would recommend installing the Tentacle agent on your Octopus Server and using the previously linked instructions (as although it is possible to run Octopus Server under a different user account it introduces a lot of complexities that are best avoided if possible).

    Please let me know if this doesn't resolve your issue or if you have any other questions,

    Regards,

    Alex

  2. 2 Posted by iginzburg on 23 Aug, 2017 07:38 PM

    iginzburg's Avatar

    Thank you
    Inna

  3. Support Staff 3 Posted by Alex Rolley on 24 Aug, 2017 12:58 AM

    Alex Rolley's Avatar

    Hi Inna,

    No problems, glad we could help!

    Regards

    Alex

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac