< -- BuySellAds Ad Code ALLEN -->
Microsoft Logo

VBS Script To Map Users Home Drives With Usernames

IT Problem

You want a vbs script that will map a users home drive based on there username and also label the home drive by there username . For Example X:\billy.

This VBS login script below will do the job. create a file called log in.vbs and copy and paste the code below. You can call it via a GPO in the lo-gin script section of group policy. You could even just add is to an individual users account.


IT Solution

The login vbs script

Set objNetwork = CreateObject("WScript.Network") strDriveLetter = "Z:" strRemotePath = "\\Server\Path" strUserName = objNetwork.Username objNetwork.MapNetworkDrive strDriveLetter, strRemotePath & "\" & strUserName, True ' If you do not want the drive labeled as the users username then just remove the lines below ' The code below labels the drive, so in the list it will appear as: <user>'s Home Drive Set objShell = CreateObject("Shell.Application") strNewName = strUserName & "'s Home Drive" objShell.NameSpace(strDriveLetter).Self.Name = strNewName

Tags: vbs

Allen White

Allen is an IT Consultant and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5, 6 and HP ASE, AIS - Network Infrastructure.

Leave a comment



What Web Browser Do You Use?

View Results

Loading ... Loading ...


What do you prefer..VMware or Hyper-V?

View Results

Loading ... Loading ...