a user is getting h drivemapped twice because he is in group IT AND LABS

WHAT DO I DO?


Dim objNetwork, objSysInfo, strUserDN, objUser, strUser

Set objNetwork = CreateObject("Wscript.Network")

Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.userName
strUser = objNetwork.UserName
Set objUser = GetObject("LDAP://" & strUserDN)

If IsMember("IT") Then
'objNetwork.removenetworkdrive "q:"
objNetwork.MapNetworkDrive "q:", "\\server\IT"
objNetwork.MapNetworkDrive "h:", "\\server\Users\" & strUser, false
End If

If IsMember("Services") Then
objNetwork.MapNetworkDrive "y:", "\\server\AcadServ"
End If

If IsMember("Administration") Then
objNetwork.MapNetworkDrive "w:", "\\server\Admin"
End If

If IsMember("Labs") Then
objNetwork.MapNetworkDrive "L:", "\\server\Lab"
objNetwork.MapNetworkDrive "h:", "\\server\Users\" & strUser, false
objNetwork.addwindowsprinterconnection "\\server\HP4100"
End If


'--------------------------------------------------------

Function IsMember(strGroup)
' Function to test one user for group membership.
' objUser is the user object with global scope.
' strGroup is the NT Name of the group to test.
' objGroupList is a dictionary object with global scope.
' Returns True if the user is a member of the group.

Dim objGroup
If IsEmpty(objGroupList) Then
Set objGroupList = CreateObject("Scripting.Dictionary")
objGroupList.CompareMode = vbTextCompare
For Each objGroup In objUser.Groups
objGroupList(objGroup.sAMAccountName) = True
Next
End If
IsMember = objGroupList.Exists(strGroup)
End Function

'----------------------------------------------------------

Re: device is in use by Torgeir

Torgeir
Fri Feb 18 07:07:02 CST 2005


Multipost; response in .wsh


Multiposting vs Crossposting
http://www.blakjak.demon.co.uk/mul_crss.htm

and

Please don't multi-post.
http://www.aspfaq.com/etiquette.asp?id=5003



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx