[gptalk] Re: How to get the list of users in a group.

  • From: "Ananth Rajagopal" <ananth.rg@xxxxxxxxx>
  • To: gptalk@xxxxxxxxxxxxx
  • Date: Fri, 21 Nov 2008 09:31:40 +0530

It works now!!

Complete Script.... to get list of users in the group pm_artists_anim

Dim arrNames()
intSize = 0

Set ObjGroup=GetObject("LDAP://CN=pm_anim_artists,cn=Users,DC=Tai3D,DC=com")

For Each strUser in objGroup.Member
    Set objUser =  GetObject("LDAP://" & strUser)
    ReDim Preserve arrNames(intSize)
    arrNames(intSize) = objUser.CN
    intSize = intSize + 1
Next

For i = (UBound(arrNames) - 1) to 0 Step -1
    For j= 0 to i
        If UCase(arrNames(j)) > UCase(arrNames(j+1)) Then
            strHolder = arrNames(j+1)
            arrNames(j+1) = arrNames(j)
            arrNames(j) = strHolder
        End If
    Next
Next

For Each strName in arrNames
    Wscript.Echo strName
Next


Thanks to Daniel and all who helped!!!

regards
Ananth.





On Mon, Nov 17, 2008 at 5:57 PM, rpo <rpo8373@xxxxxxxxx> wrote:

> hi ananth,
>
> third time lucky.
>
> try this line:
>
> GetObject("LDAP://CN=pm_anim_artists,cn=Users,DC=Tai3D,DC=com")
>
>
>
> On 17/11/2008, Ananth Rajagopal <ananth.rg@xxxxxxxxx> wrote:
> > Ron,
> >
> > I'm getting the same error...!!!
> >
> > ? help please...
> >
> > ananth :-(
> >
> >
> >
> >
> > On Fri, Nov 14, 2008 at 7:56 PM, rpo <rpo8373@xxxxxxxxx> wrote:
> > > hi again,
> > >
> > > sorry it's late, i'm tired.
> > >
> > > just realised the replacement line i gave you is incorrect. my
> apologies.
> > >
> > > so either use the alternate script aaron has offered, or the actual
> > > correct line i meant to offer is:
> > >
> > >
> > GetObject("LDAP://CN=pm_anim_artists,ou=Users,DC=Tai3D,DC=com")
> > >
> > > daniel.
> > >
> > >
> > >
> > >
> > >
> > > On 15/11/2008, Aaron Rabinowitz <rabino67@xxxxxxxxx> wrote:
> > > > I used the following script that I got off a forum that worked
> ggreat,
> > > > you only ahve to change the second line. and it will dispaly all the
> > > > suers in excel
> > > >
> > > >
> > > >
> > > > Dim objGroup, objExcel, iRow, strUser
> > > > Set objGroup =
> > GetObject("LDAP://CN=xxxxxxxx,ou=yyyyyy,dc=domain,dc=com")
> > > >
> > > > Set objExcel = CreateObject("Excel.Application")
> > > > With objExcel
> > > >  .SheetsInNewWorkbook = 1
> > > >  .Workbooks.Add
> > > >  .Visible = True
> > > >  .Worksheets.Item(1).Name = mid(objGroup.Name,
> > > > instr(1,objGroup.Name,"=") + 1 ) 'set Worksheet name to that of the
> DL
> > > >  irow=1
> > > >
> > > >  For Each strUser in objGroup.Member
> > > >    Set objUser =  GetObject("LDAP://" & strUser)
> > > >    .Cells(iRow,1) = objUser.CN
> > > >    irow=irow + 1
> > > >  Next
> > > >  .Columns(1).entirecolumn.autofit
> > > > End With
> > > >
> > > > Set objExcel = Nothing
> > > > Set objGroup = Nothing
> > > >
> > > >
> > > >
> > > >
> > > > On Fri, Nov 14, 2008 at 9:10 AM, rpo <rpo8373@xxxxxxxxx> wrote:
> > > > > hi ananth,
> > > > >
> > > > > this isn't really gpo related. and by not really, i mean...not at
> all.
> > > > >
> > > > > nevertheless, replace the following line:
> > > > >
> > > > >
> > GetObject("LDAP://CN=pm_anim_artists,DC=Tai3D,DC=com")
> > > > >
> > > > > with:
> > > > >
> > > > >
> > GetObject("LDAP://CN=pm_anim_artists,cn=Users,DC=Tai3D,DC=com")
> > > > >
> > > > > should do the trick i reckon. good luck.
> > > > >
> > > > > daniel.
> > > > >
> > > > >
> > > > > On 14/11/2008, Ananth Rajagopal <ananth.rg@xxxxxxxxx> wrote:
> > > > >> Hi All,
> > > > >>
> > > > >> We are having a 300 user AD. According to project needs we have
> > created
> > > > >> several groups. Now we wold like to get the list of users in these
> > groups.
> > > > >>
> > > > >> We got a script from MS Scriptcenter, but it is returning an
> > error....
> > > > >> please advice....
> > > > >>
> > > > >> I've attached an image of our users and groups.
> > > > >>
> > > > >> Dim arrNames()
> > > > >> intSize = 0
> > > > >>
> > > > >> Set objGroup =
> > > > >>
> > GetObject("LDAP://CN=pm_anim_artists,DC=Tai3D,DC=com")
> > > > >>
> > > > >> For Each strUser in objGroup.Member
> > > > >>     Set objUser =  GetObject("LDAP://" & strUser)
> > > > >>     ReDim Preserve arrNames(intSize)
> > > > >>     arrNames(intSize) = objUser.CN
> > > > >>     intSize = intSize + 1
> > > > >> Next
> > > > >>
> > > > >> For i = (UBound(arrNames) - 1) to 0 Step -1
> > > > >>     For j= 0 to i
> > > > >>         If UCase(arrNames(j)) > UCase(arrNames(j+1)) Then
> > > > >>             strHolder = arrNames(j+1)
> > > > >>             arrNames(j+1) = arrNames(j)
> > > > >>             arrNames(j) = strHolder
> > > > >>         End If
> > > > >>     Next
> > > > >> Next
> > > > >>
> > > > >> For Each strName in arrNames
> > > > >>     Wscript.Echo strName
> > > > >> Next
> > > > >>
> > > > >> We are "There is no such object on the server" message. Selected
> > users are
> > > > >> members of ordinary groups. So we are wondering where we went
> wrong.
> > > > >>
> > > > >> Thanks and regards
> > > > >> Ananth.
> > > > >>
> > > > >>
> > > > > ***********************
> > > > > You can unsubscribe from gptalk by sending email to
> > gptalk-request@xxxxxxxxxxxxx with 'unsubscribe' in the Subject field OR
> by
> > logging into the freelists.org Web interface. Archives for the list are
> > available at http://www.freelists.org/archives/gptalk/
> > > > > ************************
> > > > >
> > > > ***********************
> > > > You can unsubscribe from gptalk by sending email to
> > gptalk-request@xxxxxxxxxxxxx with 'unsubscribe' in the Subject field OR
> by
> > logging into the freelists.org Web interface. Archives for the list are
> > available at http://www.freelists.org/archives/gptalk/
> > > > ************************
> > > >
> > > ***********************
> > > You can unsubscribe from gptalk by sending email to
> > gptalk-request@xxxxxxxxxxxxx with 'unsubscribe' in the Subject field OR
> by
> > logging into the freelists.org Web interface. Archives for the list are
> > available at http://www.freelists.org/archives/gptalk/
> > > ************************
> > >
> >
> >
> >
> ***********************
> You can unsubscribe from gptalk by sending email to
> gptalk-request@xxxxxxxxxxxxx with 'unsubscribe' in the Subject field OR by
> logging into the freelists.org Web interface. Archives for the list are
> available at http://www.freelists.org/archives/gptalk/
> ************************
>

Other related posts: