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

PowerShellMicrosoft TechnologiesSoftware & Coding

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
raja
Updated on 13-Jul-2020 05:37:34

Advertisements