Answers for "powershell copy-item specify credentials"

0

powershell copy-item specify credentials

$Source = "C:\Downloads\myfile.txt"
$Dest   = "\\10.149.12.162\c$\skumar"
$Username = "administrator"
$Password = ConvertTo-SecureString "Complex_Passw0rd" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential($Username, $Password)

New-PSDrive -Name J -PSProvider FileSystem -Root $Dest -Credential $mycreds -Persist
Copy-Item -Path $Source -Destination "J:\myfile.txt"
Posted by: Guest on July-31-2020

Code answers related to "powershell copy-item specify credentials"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language