How to copy Items to the destination path with the different
credentials in PowerShell?


To copy the items with the different credentials you need to use the credential parameter in the Copy-Item cmdlet.

For example,

Copy-Item C:\temp\* -Destination \Remoteshare\c$\temp -Credential (Get-
Credential)

Or

$creds = (Get-Credential)
Copy-Item C:\temp\* -Destination \Remoteshare\c$\temp -Credential $creds

Updated on: 13-Jul-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements