Windows 2008 Server GPO Add personal shares
Right now each employee has their own share on the file server that uses
their first initial of their first name and their last name (ex. jsmith).
Of course John Simth has to be logged on to access the share jsmith.
The Issue: Right now I have two options to establish the jsmith share
everytime a employee logins into the domain creating a domain profile for
the 1st time. I ether 1.) manually map the drive to the share. Or 2.) use
the VBScript below and manually open it or manually put it in the startup
folder.
The Goal: I woud like to use a GPO login script or the GPO map drive
function to make sure the employee has their personal share (mapped to
W:). Right now the only solution I can figure out is to add the VBScript
below as a Login script(using GPO), BUT it will not run like it should.
There is NOTHING wrong with the script if I manually put it on the users
computer and click it. But how would I make sure the users personal share
is being mapped everytime the login to the domain on ANY computer? NOTE: I
do not need to use the login script below, but its the only option I
currently know of.
VBScript:
' Section removes W drive if exists
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
If (objFSO.DriveExists("W:") = True) Then
objNetwork.RemoveNetworkDrive "W:", True, True
End If
' Section Remaps W drive based on User Name, the OU is also stored but not
used.
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strUserName = objUser.samAccountName
strOUPath = objUser.Parent
arrContainers = Split(strOUPath, ",")
arrOU = Split(arrContainers(0), "=")
strOU = arrOU(1)
strDrive = "\\SERVER001\" & strUserName
strFirstInt= Left(strUserName,1)
strLastName= Split(strUserName, " ")(1)
strDrive = "\\192.168.0.1\" & strFirstInt & strLastName
'WScript.Echo (strDrive)
Set objNetwork = CreateObject("Wscript.Network")
objNetwork.MapNetworkDrive "W:", strDrive
No comments:
Post a Comment