Group Policy Map Drive to Display Name

active-directorygroup-policywindows-server-2008-r2

I'm trying to create a Group Policy to map users Home Drives among others when they login. All the other drives are mapping fine, however because of the way in which the usernames are formatted, I've run into a conundrum trying to get the Home Drive Mapped.

In short, the usernames are formatted Firstname.Lastname, whereas the home folders on the server are formatted as Firstname Lastname (Note the space and not [dot])

So calling all Windows GPO Gurus – do you know of a way that I can create a GPO to map a users' Home Drive using their Name, rather than their username?

For reference, we are using Windows 7 Clients with the AD Server being Server 2008 R2.

Best Answer

Here's an example of how you can do this to a single user with a script. It's crude but it works well as an example to show the process.

$user = Get-ADUser James
$homeName = $user.GivenName + " " + $user.Surname
$user | Set-ADUser -HomeDirectory \\FileServer\Users\$homeName -HomeDrive H -Credential (Get-Credential)

Replace the UNC with your file share, and change the H drive letter to whatever drive letter you want to use for the user's home drive. Once you wrap your head around this code, your next step might be to figure out how to run it against all users at once.

Related Topic