Welcome › Forums › General PowerShell Q&A › filecopy with PSdrive
- This topic has 2 replies, 2 voices, and was last updated 9 months ago by
Participant.
Viewing 2 reply threads
-
AuthorPosts
-
-
April 23, 2020 at 9:06 am #221715
Hi All,
I’m busy testing if a network drive is correctly mappedPowerShell12345678910$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”}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
-
April 23, 2020 at 3:03 pm #221844PowerShell1$destination1=”\\server\domain.com\ITglobal\MDM”
has a \ that should be a .
PowerShell1$destination1=”\\server.domain.com\ITglobal\MDM” -
April 23, 2020 at 6:19 pm #221913
Hi
no it’s suppose to be like this
PowerShell1$destination=”\\nas\companyname.com\itglobal\MDM”I adapted the names for not reveling the company name
Paul
-
-
AuthorPosts
Viewing 2 reply threads
- The topic ‘filecopy with PSdrive’ is closed to new replies.