title: New-PSDrive Command : Specified Resource not Found
body: <p>I just started to work with powershell and not able to figure out this problem. I am invoking powershell csript via Ansible and I am getting error on this command.</p>
  
  <pre><code>$password = "Password123" | ConvertTo-SecureString -asPlainText -Force
  $username = "am\user"
  $credential = New-Object System.Management.Automation.PSCredential($username,$password)
  
  New-PSDrive -Name X -PSProvider FileSystem -Root \\server\folder -Credential $credential -Persist
  </code></pre>
  
  <p>Now interesting part is, it runs fine alternate times. like first time it runs fine, second time fails and third time again works fine and so on.</p>
  
  <p>Error : The specified network resource or device is no longer available.</p>
  
  <p>Powershell version : 4
  Ansible : 2.3.3</p>