title: Permission Denied Using VBScript
body: <p>I have a script which will move and rename folders. It is successful when running it locally but when attempting to read or write to directories using mapped drives the process fails with a "Permission Denied" error.  </p>
  
  <p>Does VBScript not like mapped drives?  Below is the script with credentials to read and write to source and destination:</p>
  
  <pre><code>dim objNetwork
  
  Set objNetwork = WScript.CreateObject("WScript.Network")
  strLocalDrive = "Y:"
  strRemoteShare = "\\servername\directory"
  strPer = "False"
  strUsr = "userid"
  strPas = "password"
  objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
  
  Dim fso, objFol, objMoveFol, strPathBuild
  
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set objFol = fso.GetFolder("D:\Source")
  
  For Each objMoveFol In objFol.SubFolders
  
      'Replace the root folder locations in the path
      strPathBuild = Replace(objMoveFol, "D:\Source", "Y:\Destination")
  
      'Do the required other fiddle
      strPathBuild = Replace(strPathBuild, "A.", "Ack~")
  
      fso.Movefolder objMoveFol, strPathBuild
  
  Next
  </code></pre>