Bluetooth Posted November 20, 2009 Posted November 20, 2009 Hi All. I map all my drives via bat file, a seperate bat file for pupils and staff. Now a teacher expressed an idea that it would be good if i could change the names of the drives from the default path shown to something more friendly. So when you map a drive lets say to \\server\home\ it will show up in my computer as a drive, with the above and the drive assignment. So is there a way to change it to something like "Childrens Work Area (H:)"?
apeo Posted November 20, 2009 Posted November 20, 2009 Would renaming it via script do the trick?: option explicit dim mdrive, oshell, fso set fso=createobject("Scripting.FileSystemObject") 'Rename User Home Directory if fso.driveexists("H:") then mdrive = "H:\" Set oShell = CreateObject("Shell.Application") oShell.Namespace(mdrive).Self.Name = "Childrens Work Area" end if
Bluetooth Posted November 20, 2009 Author Posted November 20, 2009 Maybe! Would i put that in with the batch file or give each drive rename its own vbs script?
altecsole Posted November 20, 2009 Posted November 20, 2009 We use a vbscript that modifies the users registry with the name of the drive. In the example below the mapped drive is mapped and shows as 'Student Resources'. We also use a DFS namespace. Hope that helps. Option Explicit On Error Resume Next Dim objFSO,objFILE,objShell,objNetwork set objFSO=CreateObject("Scripting.FileSystemObject") set objShell=CreateObject("Wscript.Shell") set objNetwork=CreateObject("Wscript.Network") Dim strHelpMsg, iErrorTimeout, blnShowError strHelpMsg="Contact QES IT Support Help Desk for further assistance." iErrorTimeout=10 blnShowError=True 'setup friendly names for mapped drives objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##queenelizabeth#data#StudentResources\_LabelFromReg", "Student Resources", "REG_SZ" 'Map network drives MapIt "R:", "\\queenelizabeth\data\StudentResources" Sub MapIt(strDrive,strMap) Const FORCE_REMOVE = True Const UPDATE_PROFILE = True Const NOT_PERSISTENT = False Dim strMsg On Error Resume Next If objFSO.DriveExists(strDrive) Then objNetwork.RemoveNetworkDrive strDrive, FORCE_REMOVE, UPDATE_PROFILE End If objNetwork.MapNetworkDrive strDrive, strMap, NOT_PERSISTENT If Err.Number <> 0 And blnShowError Then strMsg="There was a problem mapping drive " & UCase(strDrive) & " to " &_ strMap & VbCrLf & strHelpMsg & VbCrLf & "Error#:" & hex(err.Number) &_ VbCrLf & Err.Description objShell.Popup strMsg,iErrorTimeOut,"Error",vbOKOnly+vbExclamation End If End Sub
apeo Posted November 20, 2009 Posted November 20, 2009 its vbscript so run it during logon (assume drive assignment happens during logon) but after the drives have been assigned. As for each drive, you just include that in the same script e.g. the script below has 2 drives renamed: option explicit dim mdrive, oshell, fso set fso=createobject("Scripting.FileSystemObject") 'Rename User Home Directory if fso.driveexists("H:") then mdrive = "H:\" Set oShell = CreateObject("Shell.Application") oShell.Namespace(mdrive).Self.Name = "Childrens Work Area" end if 'Rename another directory if fso.driveexists("Z:") then mdrive = "Z:\" Set oShell = CreateObject("Shell.Application") oShell.Namespace(mdrive).Self.Name = "Some other Area" end if
john Posted November 20, 2009 Posted November 20, 2009 If you have Server 2008 you can also do this as part of the Drive Mapping Process in GPOs
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now