# Error in copying Files to Remote PC using Powershell

**URL:** <https://forums.powershell.org/t/error-in-copying-files-to-remote-pc-using-powershell/8648>\
**Category:** PowerShell Help\
**Created:** [May 18, 2017, 2:26am UTC](https://forums.powershell.org/t/error-in-copying-files-to-remote-pc-using-powershell/8648 "2017-05-18T02:26:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rishabh-a](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@rishabh-a](https://forums.powershell.org/u/rishabh-a)\
**Post date:** [May 18, 2017, 2:26am UTC](https://forums.powershell.org/t/error-in-copying-files-to-remote-pc-using-powershell/8648/1 "2017-05-18T02:26:26Z")

</div>

```
$ip = '\\192.168.233.128\Test'
 $password = "abc123!" | ConvertTo-SecureString -asPlainText -Force
 $username = "Administrator" 
 $credential = New-Object System.Management.Automation.PSCredential($username,$password)
 New-PSDrive -Name Z -PSProvider FileSystem -Root $ip -Credential $credential -ErrorAction Stop 
 dir C:\File_One.txt | copy -Destination Z: -PassThru
 Remove-PSDrive -name Z
```

This Code Works fine between my base machine and VM, It also worked with another PC connected to my router.  
But when i tried Implementing it on clients network it doesn’t let me create the PSDrive, and Script Failed.  
The credentials provided were correct.

Any help would be beneficial.

---

<div class="post-metadata">

**Author:** ![vmotion1984](https://avatars.discourse-cdn.com/v4/letter/v/7feea3/32.png) [@vmotion1984](https://forums.powershell.org/u/vmotion1984)\
**Post date:** [May 18, 2017, 7:56am UTC](https://forums.powershell.org/t/error-in-copying-files-to-remote-pc-using-powershell/8648/2 "2017-05-18T07:56:41Z")

</div>

if you do the action manaul does it give an error? Then you can see if it has to do something with rights/policy

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:38pm UTC](https://forums.powershell.org/t/error-in-copying-files-to-remote-pc-using-powershell/8648/3 "2024-05-16T20:38:44Z")

</div>


