01.I assume you have shared a folder in the server that in side it there are folders to according the user names in the Active directory.

02.Open the note pad and type and paste the following vb script code.
' Vb Script to map a network drive to the User Name..
' Version 1.0 -September 12 , 2009
' http://rmtpriyantha.blogspot.com
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath, strUserName
strDriveLetter = "J:"
'------------------------------------------------------------
'Change the UNC pah according to your environment
'------------------------------------------------------------
strRemotePath = "\\Knights-dc\Shared Docs"
' Purpose of script to create a network object. (objNetwork)
' Then to apply the MapNetworkDrive method. Result J: drive
Set objNetwork = WScript.CreateObject("WScript.Network")
' Here is where we extract the UserName
strUserName = objNetwork.UserName
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath _
& "\" & strUserName
' Extra code just to add a message box
WScript.Echo "Folder is mapped as J drive."
WScript.Quit
' End of Map Network Drive Example logon script.
03. Save the file with .VBS extension
Eg: Foldermap.vbs
04.now you can run the file in the and see if wither it works,
if it works correctly you there will be a massage that saying "Folder is mapped as J drive."
05. After that run the scirpt as a login script using AD group policy. Visit the following site for more details of login script through GPO.
http://www.petri.co.il/setting-up-logon-script-through-gpo-windows-server-2008.
0 comments:
Post a Comment