Friday, August 23, 2013

The Big Red X: Disconnected Network Drive Maps and Group Policy

For years, I have been running a very reliable Logon  batch file that mapped various network drives on our network.  If you have never created a Logon script all you need is a notepad. 

My script called  for the deletion of any current mapped drives and it replaced all of those with usually the exact same mapping.  It worked 99.9% of the time and if it didn't a quick restart usually resolved the issue. 

 Here is my old Script:

Then one morning all the peace and tranquility was lost.
My phone was ringing off the hook with network users complaining that they couldn't access various mapped drives or the software that ran from those drives just wasn't running.  Mapped drives just stopped working.
When I looked into it, all of their mapped drives had a an ugly red X on them.
While I am still uncertain of the cause, a recent change in DHCP lease time and DNS scavenging did coincide with the problem.
  • I could ping the server to which they were mapping.
  • I could navigate to it via the path.
  • I could even click the Big Red X on the drive letter and see the content of the mapped drive.
Several things that didn't work
1. Praying to the Flying Spaghetti Monster for help
2. Re-writing my logon.bat script
3. Creating a batch file to run as script that delete all drives and then running my old script.
4. Changing my logon to a VBS logon script with fancy, fancy code that's twice as long.
5. Applying mapped drives to domain Computers (not users) via Group Policy
This is what worked for me.
Remove the Logon.bat from the users profile
1. Click AD -  users and computers
2. Go to your DOMAIN
3. Choose the user group in question.
4. Choose the trouble user (s)
5. Right click, choose properties
6. Go to the Profile Tab
7. Remove your former Logon script (make note of the drives you need mapped first)
Add the Mapped Drives through Group Policy Management
1. Open your Domain under Group Policy Management
2. Go to your Group Policy Objects
3. Right Click and create a new Policy.  Just call it "Mapped Drives"
4. Right Click the new GPO called Mapped Drives, and choose Edit
5. Expand the User Configuration
6. Expand Preferences
7. Expand Windows Settings
8.  Choose Drive Maps
9.  Create a mapped drive for all of the drives formerly mapped with the logon script.
10. Make sure to choose reconnect
11. Change the action to Update
12.  Make sure Show This drive is checked
13.  You won't need to give it a Label.
Update the Group Policy on the Domain controller and possibly on the end user.
1. Go to the Domain Controller
2. open a command prompt and run a gpupdate.exe /force
Now in theory this should force the policy the next time the user logs into your domain, so telling them to log off and back on SHOULD do the trick. 
However, I found on some users I needed to manually run a GPUPDATE.exe /force from a run command.   Then restart their computer.
After that, all drives appeared connected and seem to hold.