filecopy with PSdrive

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

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

has a \ that should be a .

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

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