Electro121
Technical User
Hi All,
I've created a basic script that tries to map a drive based on group membership as well as a user home drive mapping. The script runs fine under my account (domain admin acount) but not so well under regular domain user account. I don't think the problem is specifically with the script but thought someone may have an idea here...
I've put my account and the test user account into a test OU and applied a group policy to run the script. Again, the script runs under both my account and the test user account. Only my account does all the mappings and the test user does not. The test user only maps the home drive mapping and not the group drive mapping. The user is in the correct group as specified in the script. I suspect it to be a permissions issue somewhere but can't seem to track it down. As soon as I put my test user in the domain admin group all the mappings work fine.
My active directory has authenticated users set to read all objects. I've also tried granting authenticated users full permissions on the AD tree but still no luck.
HELP!!!
Darryl
The script as follows:
'==========================================================================
'
' NAME: LogonScript.vbs
'
' AUTHOR: Darryl Brambilla
' DATE : 6/13/2005
'
' COMMENT:
'
'
'==========================================================================
On Error Resume Next
'==========================
'Setup Variables to be used
'==========================
Dim WSHShell, objSysInfo, objNetwork, objUser, objGroup
'=================================
'Synchronizes the time with Server
'=================================
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run "NET TIME \\server1 /set /y"
'===================================
'Map Drive based on group membership
'===================================
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
Select Case strGroupName
Case "Group1"
objNetwork.MapNetworkDrive "X:", "\\server1\groupshare1"
Case "All-Users"
objNetwork.MapNetworkDrive "P:", "\\Server2\public"
End Select
Next
'==============
'Map User Drive
'==============
strHomeServer="\\Server3\"
strUserName = objNetwork.UserName
strUserNameFull = strUserName & "$"
objNetwork.MapNetworkDrive "u:", strHomeServer & strUserNameFull
'=======================
'Clean Up Memory We Used
'=======================
set WSHShell = Nothing
set objSysInfo = Nothing
set objNetwork = Nothing
set objUser = Nothing
set objGroup = Nothing
'===============
'Quit the Script
'===============
wscript.quit
I've created a basic script that tries to map a drive based on group membership as well as a user home drive mapping. The script runs fine under my account (domain admin acount) but not so well under regular domain user account. I don't think the problem is specifically with the script but thought someone may have an idea here...
I've put my account and the test user account into a test OU and applied a group policy to run the script. Again, the script runs under both my account and the test user account. Only my account does all the mappings and the test user does not. The test user only maps the home drive mapping and not the group drive mapping. The user is in the correct group as specified in the script. I suspect it to be a permissions issue somewhere but can't seem to track it down. As soon as I put my test user in the domain admin group all the mappings work fine.
My active directory has authenticated users set to read all objects. I've also tried granting authenticated users full permissions on the AD tree but still no luck.
HELP!!!
Darryl
The script as follows:
'==========================================================================
'
' NAME: LogonScript.vbs
'
' AUTHOR: Darryl Brambilla
' DATE : 6/13/2005
'
' COMMENT:
'
'
'==========================================================================
On Error Resume Next
'==========================
'Setup Variables to be used
'==========================
Dim WSHShell, objSysInfo, objNetwork, objUser, objGroup
'=================================
'Synchronizes the time with Server
'=================================
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run "NET TIME \\server1 /set /y"
'===================================
'Map Drive based on group membership
'===================================
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
Select Case strGroupName
Case "Group1"
objNetwork.MapNetworkDrive "X:", "\\server1\groupshare1"
Case "All-Users"
objNetwork.MapNetworkDrive "P:", "\\Server2\public"
End Select
Next
'==============
'Map User Drive
'==============
strHomeServer="\\Server3\"
strUserName = objNetwork.UserName
strUserNameFull = strUserName & "$"
objNetwork.MapNetworkDrive "u:", strHomeServer & strUserNameFull
'=======================
'Clean Up Memory We Used
'=======================
set WSHShell = Nothing
set objSysInfo = Nothing
set objNetwork = Nothing
set objUser = Nothing
set objGroup = Nothing
'===============
'Quit the Script
'===============
wscript.quit