Error: Move-Item: Access is denied (UnauthorizedAccess Exception)
Aus Wiki-WebPerfect
Version vom 20. Oktober 2017, 13:54 Uhr von Admin (Diskussion | Beiträge)
Inhaltsverzeichnis
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"