Logon script: Group membership not recognized?

Giganews Newsgroups
Subject: Logon script: Group membership not recognized?
Posted by:  Mike (Mi…@discussions.microsoft.com)
Date: Mon, 29 Jan 2007

The logon script below disconnects a couple drive letters and then maps them
to the appropriate share based on group membership. The script works just
fine, but it doesn't run properly for a few people.

For the people it doesn't run properly for, the script disconnects the S and
P drives like it should. However, the section where it maps the S and P
drives for users in the DEPT Employees group does not run for these few
users. These users are members of that group.

Any ideas? The script is solid, so the problem must be with the user
accounts. The script is pasted below just so you can see it.

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

'These 2 lines force the drives to be disconnected
'The first TRUE unmaps the drive even if in use
'The second TRUE removes the mapping from the user profile

objNetwork.RemoveNetworkDrive "S:", True, True
objNetwork.RemoveNetworkDrive "P:", True, True

strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)

For Each strGroup in objUser.MemberOf
    strGroupPath = "LDAP://" & strGroup
    Set objGroup = GetObject(strGroupPath)
    strGroupName = objGroup.CN

'TRUE in the statements below stores the drive mapping in the user profile
'making the mapping persist and available when disconnected from the network

    Select Case strGroupName
        Case "DEPT Employees"
            objNetwork.MapNetworkDrive "S:", "\\server1\shared", True
        objNetwork.MapNetworkDrive "P:",
"\\server2\fsTaskMan\Report\OutputFiles", True
    End Select
Next

Replies