IfMember()
' -----------------------------------------------
' IfMember()
' Returns TRUE if the user is a member of the
' specified group, otherwise FALSE.
' -----------------------------------------------
Function IfMember(objUser, strGroupName)
Dim colGroups, objGroup
' Get all groups user is member of
Set colGroups = objUser.Groups()
' Test if each group is our group...
For Each objGroup In colGroups
'WScript.Echo "IfMember(): " & strGroupName & " = " & objGroup.cn & " ?" 'DBG
If objGroup.cn = strGroupName Then
' and if it is, we return TRUE and exit
IfMember = True
Exit Function
End If
Next
' No group matched our group, return FALSE
IfMember = False
End Function
' IfMember()
' Returns TRUE if the user is a member of the
' specified group, otherwise FALSE.
' -----------------------------------------------
Function IfMember(objUser, strGroupName)
Dim colGroups, objGroup
' Get all groups user is member of
Set colGroups = objUser.Groups()
' Test if each group is our group...
For Each objGroup In colGroups
'WScript.Echo "IfMember(): " & strGroupName & " = " & objGroup.cn & " ?" 'DBG
If objGroup.cn = strGroupName Then
' and if it is, we return TRUE and exit
IfMember = True
Exit Function
End If
Next
' No group matched our group, return FALSE
IfMember = False
End Function
If IfMember(objUser, "London_Techs") Then
MapADDrive("M:", "\\w2ksrv1\share1")
End If
MapADDrive("M:", "\\w2ksrv1\share1")
End If
Tests if a user is a member of the specified group.
| Requires: | A user class object and the name of the group it should be tested against. |
| Returns: | True if user is a member, False otherwise. |
