title: How to access a network shared drive inside Invoke-command
body: <p>I was using below script to copy files from network share to local drive. But,I was not able to access path and getting Path not found error. MY use case is I need to execute this script from Jenkins server and remote into server1 and then have copy files from shared directory (\server2\QlikView) which is already mounted to the server1 as S:\ drive. I was able to access this shared path from powershell If I run the command from server1.But, not inside Invoke-Command script block as shown. Any thoughts on this?</p>
  
  <pre><code>$server = "server1"
  $source_dir = "\\server2\QlikView"
  $processing_dir = "M:\script_test\processing"
  $processed_dir = ""
  $user = 'Domain\user1'
  $Password = '******'
  $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
  $cred = New-Object System.Management.Automation.PSCredential -ArgumentList $User, $SecurePassword
  
   Invoke-Command -ComputerName $server -Credential $cred -ScriptBlock {
    param ($server,$source_dir,$processing_dir)
  echo "$source_dir"
   Test-path $source_dir
   copy-item -Path $source_dir\* -Destination M:\script_test
    } -ArgumentList $server,$source_dir,$processing_dir
  </code></pre>