How do you map a network drive using Group Policy? You use Group Policy Preferences. No script required.
I got a pretty typical request from a client today. He'd hired a new employee, for whom i'd installed a computer a few days ago. One thing i hadn't done was to map to a network drive. Typical task, typical setting. I don't know why she (the new hire) didn't have the drive mapped but i promised him (my client) i'd fix it tonight. Which i did.
There are two ways to map a network drive:
- the Stupid way, which is to log in on a computer as the user and map the network drive and set it to re-map between sessions (/persistent:yes)
- the Ordinary way, which is to have a logon script run from the logon server, mandated by group policy.
There is also a New way offered on Windows Server 2008: Group Policy Preferences. Unlike Group Policy Settings, preferences are something that are suggested rather than mandated to the user, who may change the suggested preferences if so wanted. Another thing is that there are a bunch more preferences available than i'd found in GP Settings, and the one i was looking for was indeed the preference for drive maps.
For magic to happen, open the Group policy manager and create a new Group policy opject (GPO) where the users you want to target are. Call it Drive mappings. Go to User configuration -> Preferences -> Windows settings -> Drive maps. Right-click it and New -> Mapped drive. Set Action as Update (or Replace; see help file for info), fill in the UNC path (ie. \serversharename), give it a nifty Label and a Drive letter. And you're there. Repeat for other drive letters as necessary, creating other GPOs for other groups who have their own network drives. There's even variable substitution so you could probably map a drive for a group or a site or something equally local.
Given all this, drive letters are hopelessly outdated; it's just the fact that people are so used to them that it'll take a while for them to die out. And the same goes for home directories on the net. The Correct Way would be to have the venerable [My] Documents folder silently residing on the server and replicated for offline use (hint: use Folder Redirection), and any shared or common folders under the Libriaries meta-folder-thingy on the new and improved Windows 7 file explorer.
But that's for another time, when i've updated all their workstations to Windows 7.