Error: Move-Item: Access is denied (UnauthorizedAccess Exception)

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche

Error

Move-Item:_Access_is_denied_(PermissionDenied:_[Move-Item]_UnauthorizedAccess_Exception)

Cause

Providing the fully qualified name is required for any remote call. In other words, if your location starts with \\ then you need to add Microsoft.PowerShell.Core\FileSystem:: as a prefix. If you reference a local drive, you shouldn’t prefix the local drive. This worked perfectly, even remoting to both computers.


Solution

  • Add fully qualified for a share (Microsoft.PowerShell.Core\FileSystem::)

Example

 Move-Item -Path "Microsoft.PowerShell.Core\FileSystem::\\<Hostname>\C$\temp\testfile.txt" -Destination "Microsoft.PowerShell.Core\FileSystem::\\<Destination-Hostname>\C$\temp\testfile.txt"