Reduce delay of seeing drives as “active” and ready after switching to/from VPN

It sure takes many moons to see your drives if you switch to and from a VPN. We developed a switching app that maps drives to sharepoint or the VPN. After some digging around – i found a powershell script that did a System.IO.DriveInfo() command which seemed to delay things for a small amount but the drives became active right away. Cool I said. So i then modified it to do a

  • netuse then
  • System.IO.DriveInfo() then do a
    • and print out the status of each drive
    • and finally
  • netuse (to see any changes)

It seems to work. The “ah ha” moment came from when I tried this program from this guy. I have since morphed it into function that accepts the drive letter and the \\server\share path and does a netuse in front and in back.