Try this function. I am not sure where I found it, but have had it for
a while:
Function IsMember(sGroup)
Dim sAdsPath, oUser, oGroup
If IsEmpty(oGroupDict) Then
Set oGroupDict = CreateObject("Scripting.Dictionary")
oGroupDict.CompareMode = vbTextCompare
sAdsPath = oNet.UserDomain & "/" & oNet.UserName
Set oUser = GetObject("WinNT://" & sAdsPath & ",user")
For Each oGroup In oUser.Groups
oGroupDict.Add oGroup.Name, "-"
Next
Set oUser = Nothing
End If
IsMember = CBool(oGroupDict.Exists(sGroup))
End Function
It works well for me.
HTH...
Brian
-----Original Message-----
From: Chris Levis [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 18, 2002 1:04 PM
To: NT 2000 Discussions
Subject: VBScript, getting group membership?
After googling and msdn'ing, I've been unable to figure this out:
How can I test a user's AD group membership using VBScript? i.e., I
want to do the vbscript equivalent of kixtart's "IF INGROUP".
Any ideas/samples?
Thanks a bunch!
___________________________
Chris Levis
Applied Geographics, Inc.
There are 10 types of people in the world: those who understand binary,
and those who do not.
------
You are subscribed as [EMAIL PROTECTED]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to %%email.unsub%%
------
You are subscribed as [email protected]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to [EMAIL PROTECTED]