# filecopy with PSdrive

**URL:** <https://forums.powershell.org/t/filecopy-with-psdrive/14231>\
**Category:** PowerShell Help\
**Created:** [April 23, 2020, 3:36am UTC](https://forums.powershell.org/t/filecopy-with-psdrive/14231 "2020-04-23T03:36:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![acer4605](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@acer4605](https://forums.powershell.org/u/acer4605)\
**Post date:** [April 23, 2020, 3:36am UTC](https://forums.powershell.org/t/filecopy-with-psdrive/14231/1 "2020-04-23T03:36:38Z")

</div>

Hi All,  
I’m busy testing if a network drive is correctly mapped  
[pre]  
$destination1=“\server\domain.com\ITglobal\MDM”  
#$destination2 = “\backup.domain.com\laptop-backup-01\username$”  
if(!(test-path Z:)){  
write-host “checking if networkdrive is mapped”  
$cred = Import-Clixml -Path “${env:\userprofile}\Paulst.Cred”

New-PSDrive -name Z -root $destination -PSProvider FileSystem -Credential $cred  
}Else {  
Write-Host “drive is mapped”  
}  
[/pre]  
When I do use the destination2 location it’s working like a charm  
however when I use destination location it will fail even when I have this drive correctly mapped in my windows explorer and can access it.  
how can I check where it goes wrong?

thanks Paul

---

<div class="post-metadata">

**Author:** ![rob-simmers](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rob-simmers/32/1010_2.png) [@rob-simmers](https://forums.powershell.org/u/rob-simmers)\
**Post date:** [April 23, 2020, 9:33am UTC](https://forums.powershell.org/t/filecopy-with-psdrive/14231/2 "2020-04-23T09:33:11Z")

</div>

```
$destination1=”\\server\domain.com\ITglobal\MDM”
```

has a \ that should be a .

```
$destination1=”\\server.domain.com\ITglobal\MDM”
```

---

<div class="post-metadata">

**Author:** ![acer4605](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@acer4605](https://forums.powershell.org/u/acer4605)\
**Post date:** [April 23, 2020, 12:49pm UTC](https://forums.powershell.org/t/filecopy-with-psdrive/14231/3 "2020-04-23T12:49:05Z")

</div>

Hi

no it’s suppose to be like this  
[pre]  
$destination=“\nas\companyname.com\itglobal\MDM”

[/pre]  
I adapted the names for not reveling the company name

Paul

---

<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:29pm UTC](https://forums.powershell.org/t/filecopy-with-psdrive/14231/4 "2024-05-16T20:29:50Z")

</div>

Closed on May 16, 2024, 8:29pm UTC


