title: New-PSDrive drive mapping name
body: <p>In my powershell script i am using New-PSDrive function to map remote server file path into my local computer as windows deployment operation proccess.</p>
  
  <p>I plan to reuse this Powershell script in the future, so i dont want any conflict between drives because of naming. For example, if two deployment operations need to reach the script at the same time, then one of two will be deployed uncorrectly.</p>
  
  <p>That's the question: Can i use timestamp or any other unique information as a drive mapping name? That way, i can be sure of avoiding name conflict.</p>
  
  <p>Edit:</p>
  
  <p>I have tried to create custom named new-psdrive mapping without persist parameter, but that way, powershell tries to reach the folder with relative path (under the current working directory) </p>
  
  <p>Here is the code where i try to copy some files (backup):</p>
  
  <pre><code>$day = Get-Date -Format "yyyyMMdd"
  $appsource = "\\$computername\D$\Applications"
  
  New-PSDrive -Name J -PSProvider FileSystem -Root $appsource-Credential $cred -persist
  
  Write-Host "Backup işlemi başladı." 
  robocopy "J:\App" "J:\backup\$day"
  </code></pre>
  
  <p>Edit 2:</p>
  
  <p>You can not use a dynamic name as a persisted drive mapping name. If you are to reach cross domain computer, the best way is (but cost-effective way) to use Invoke-Command for running script on remote computer. 2 way (remote-local, local-remote) file-sharing permissions are need to be allowed. If you use Invoke-Command, you are conflict-free. Because the command uses dynamic session on the remote computer.</p>