I am trying to copy the text file “1.txt” to remote share location using start-bitstransfer. I want to copy using a service account that has modify permission on remote share. Below is the code I am working with. However when I run it in Powershell ISE (admin context) I get error -> Start-BitsTransfer : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))access denied. It seems that PScredential class is not storing the credentials provided in script. I say this because when I run the same script to copy “1.txt” to different remote location in Powershell ISE (admin context) it gets copied irrespective of random values I supply in $username & $password variable. Would like to know your thoughts on this. Thanks.
$share = "\\remote\share\"
As a test, try creating $Credential using New-PSCredential.
You must be logged in to reply to this topic.