That works fine after a few tests.
Code: Select all
$Source = "PATHA"
$Dest = "PATHB"
$Username = "{USR}"
$Password = ConvertTo-SecureString "{PWD}" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential($Username, $Password)
New-PSDrive -Name K -PSProvider FileSystem -Root $Dest -Credential $mycreds -Persist
Copy-Item -Path $Source -Destination $Dest
Remove-PSDrive -Name K