NT 4.0 find all members in all groups?
Try this, it will get a list of all the groups a user belongs to then call a
function for specific groups if the user belongs to that group...
adsPath = "WinNT://YourDomain/" & strUser
set dsObj = GetObject(adsPath)
For Each Prop In dsobj.groups
Select Case Prop.Name
Case "Domain Admins"
'WshShell.popup "You are an Administrator"
Call Administrators()
Case "gzWellington"
'WshShell.popup "You are a gz'er"
Call gzStaff()
End Select
' Add the group name to a string
sMsg = sMsg & Prop.Name & sLF
Next 'Prop
' Display a message showing the groups the user belongs to
WshShell.Popup "You have been logged onto the domain" & sLf &_
"with the following permissions:" & sLf &_
sMsg, 5, "gzLogon Completed", 64
Regards,
Ian
WSH FAQ http://wsh.glazier.co.nz/frame.htm
Quote:
>THis is nice.
>What's the object or syntax to get a name of a particular group?
>I'd like to check if a user belongs to a certain group, if so do something.
>In this case I'd like to use SELECT CASE statement instead of IF..Then
using
>the IsMember statement.
>Thanks.
>Hang Hieng
> No... but if you are imaginative and put two and two together you will
>get what you want. There is a code sample in the faq that enumerates domain
>objects. And a code sample in the faq that returns group membership. There
>you go.
> Now for the spoon.... This is off the top of my head. You may need to
>trouble shoot it.
> Set DomainObj = GetObject("WinNT://Your_Domain")
> DomainObj.Filter = Array("groups")
> For each Group in DomainObj
> List = List & Group.Name & vbcrlf
> Set GroupObj = GetObject("WinNT://your_domain/" & Group.Name)
> For each Member in GroupObj.members
> List = List & vbtab & Member.Name & vbcrlf
> Next
> Next
> Msgbox List
> Clarence
> Check it out
> http://cwashington.netreach.net
> Win32 bit scripting. Everything you need to get up and running,
> A script repository containing almost 100 sample scripts,
> downloads, reference files, and technical support via an
> online discussion forum.
> (Pursuant to US Code, Title 47, Chapter 5, Subchapter II, 227, any and
>all
> unsolicited commercial E-mail sent to this address is subject to a
>download
> and archival fee in the amount of $1000 US. E-mailing denotes
>acceptance of
> these terms.)
> what I really want is to display all groups with the users in each
group
> i.e.
> Programming (GROUP)
> joe blogs (MEMBER)
> will patton (MEMBER)
> that type of thing, your site doesn't seem to have a script to do that?
> thanks :-)
> CaM
> You can find this in the ADSI Faq on my site. Additionally there
are
>several scripts in the script repository that will be of use to you.
> Clarence
> Check it out
> http://cwashington.netreach.net
> Win32 bit scripting. Everything you need to get up and running,
> A script repository containing almost 100 sample scripts,
> downloads, reference files, and technical support via an
> online discussion forum.
> (Pursuant to US Code, Title 47, Chapter 5, Subchapter II, 227, any
>and all
> unsolicited commercial E-mail sent to this address is subject to a
>download
> and archival fee in the amount of $1000 US. E-mailing denotes
>acceptance of
> these terms.)
> can someone please supply a script that will show me all the users
>of all
> groups in a domain?
> CaM