# Access is Denied error

**URL:** <https://forums.powershell.org/t/access-is-denied-error/2367>\
**Category:** PowerShell Help\
**Created:** [March 22, 2014, 2:54pm UTC](https://forums.powershell.org/t/access-is-denied-error/2367 "2014-03-22T14:54:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonholman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/simonholman/32/880_2.png) [@simonholman](https://forums.powershell.org/u/simonholman)\
**Post date:** [March 22, 2014, 2:54pm UTC](https://forums.powershell.org/t/access-is-denied-error/2367/1 "2014-03-22T14:54:41Z")

</div>

I created a PSSession to a Hyper-V host from my admin server while logged in as a domain administrator.

When I tried to copy a file from a share on the admin server to the local dir on the Hyper-V host, I got an Access is Denied error. The command was “copy \admin1\certs\certfile.pfx” c:\certs"

Same thing when I tried to execute a ps1 script from the share on the admin server (After enabling RemoteSigned execution policy).

I RDP’d into the server and performed both actions without any error.

I was logging on to both servers with the same domain admin credentials.

---

<div class="post-metadata">

**Author:** ![simonholman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/simonholman/32/880_2.png) [@simonholman](https://forums.powershell.org/u/simonholman)\
**Post date:** [March 22, 2014, 2:56pm UTC](https://forums.powershell.org/t/access-is-denied-error/2367/2 "2014-03-22T14:56:01Z")

</div>

I just re-read the error and it says that “Cannot find path ‘\admin1\certs\certfile.pfx’ because it does not exist.”

I copied and pasted the same command via the RDP session and it worked.

---

<div class="post-metadata">

**Author:** ![proxb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/proxb/32/611_2.png) [@proxb](https://forums.powershell.org/u/proxb)\
**Post date:** [March 23, 2014, 7:19am UTC](https://forums.powershell.org/t/access-is-denied-error/2367/3 "2014-03-23T07:19:42Z")

</div>

This sounds like a “double hop” issue where you are trying to access a remote system while currently in a pssession on a different remote system. This is because the Hyper-V host will not delegate your credentials to allow access to another remote system by default. In that case, you have one of two options: [Enable CredSSP](http://msdn.microsoft.com/en-us/library/ee309365(v=vs.85).aspx) on the Hyper-V server or configure Delegated Administration for the endpoint on the Hyper-V server. This is done by creating a new remote endpoint and specifying a ‘RunAs account’ that will then run all commands that you issue while in a remote pssession.

---

<div class="post-metadata">

**Author:** ![simonholman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/simonholman/32/880_2.png) [@simonholman](https://forums.powershell.org/u/simonholman)\
**Post date:** [March 23, 2014, 8:04am UTC](https://forums.powershell.org/t/access-is-denied-error/2367/4 "2014-03-23T08:04:30Z")

</div>

Thanks Boe. It wasn’t a Powershell “double hop”, but I was connected to my PC via RDP so I guess it could be the same thing. I’ll try it directly from my PC today and see if it works.

---

<div class="post-metadata">

**Author:** ![proxb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/proxb/32/611_2.png) [@proxb](https://forums.powershell.org/u/proxb)\
**Post date:** [March 23, 2014, 9:30am UTC](https://forums.powershell.org/t/access-is-denied-error/2367/5 "2014-03-23T09:30:47Z")

</div>

So this is working now? Just making sure based on the above response.

---

<div class="post-metadata">

**Author:** ![simonholman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/simonholman/32/880_2.png) [@simonholman](https://forums.powershell.org/u/simonholman)\
**Post date:** [March 23, 2014, 6:10pm UTC](https://forums.powershell.org/t/access-is-denied-error/2367/6 "2014-03-23T18:10:24Z")

</div>

No, it’s still not working, but I think I may have done something wrong on my end with the share it’s connecting to. Everything else including making directories seems to work over this Session.

---

<div class="post-metadata">

**Author:** ![proxb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/proxb/32/611_2.png) [@proxb](https://forums.powershell.org/u/proxb)\
**Post date:** [March 23, 2014, 9:33pm UTC](https://forums.powershell.org/t/access-is-denied-error/2367/7 "2014-03-23T21:33:53Z")

</div>

You can create directories on the remote system or locally while in the pssession? Just getting clarification.  
PSsessions work differently than RDP sessions. You will not be able to access anything other than the local resources of the machine that you are in the pssession in. Attempts to access remote systems from that system you are in the pssession in will result in _access denied_ and _cannot find path_ errors.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:52pm UTC](https://forums.powershell.org/t/access-is-denied-error/2367/8 "2024-05-16T20:52:19Z")

</div>


