RE: Exporting member of a particular group using csvde by ZiadKChafi
ZiadKChafi
Thu Mar 27 05:31:01 PDT 2008
Any time man, no prob. Just rate the post plz so that others can use it later.
--
Ziad K. Chafi
CompTIA A+, CompTIA N+, MCP, MCDST, MCAS: S, MCSE: S, MCDBA, MCTS, MCT
"Graham" wrote:
> Hi Ziad,
>
> Yep, that worked a treat, thanks very much for all your help.
>
> Graham
>
> "Ziad K. Chafi" wrote:
>
> > OK, this should work, but make sure to place a comma before closing the
> > quotation, line 4 should be somethig like this:
> >
> > strContainer = "cn=test users,ou=users,ou=tier2,ou=tier3,"
> >
> > --
> > Ziad K. Chafi
> > CompTIA A+, CompTIA N+, MCP, MCDST, MCAS: S, MCSE: S, MCDBA, MCTS, MCT
> >
> >
> > "Graham" wrote:
> >
> > > Hi Ziad,
> > >
> > > Initially I tried it with nested groups as follows:
> > >
> > > cn=test users,ou=users,ou=tier2,ou=tier3
> > >
> > > but I also tried it on another group example:
> > >
> > > cn=all birmingham, ou=dominogroups
> > >
> > > Thanks
> > >
> > > Graham
> > >
> > >
> > >
> > > "Ziad K. Chafi" wrote:
> > >
> > > > Hi Graham,
> > > > If it does not cause a security issue, can you please send me the group name
> > > > and the ou where it is place, and if the ou is nested, please send the names
> > > > of all parent OUs, you can use psudonames if you want no porblem.
> > > > --
> > > > Ziad K. Chafi
> > > > CompTIA A+, CompTIA N+, MCP, MCDST, MCAS: S, MCSE: S, MCDBA, MCTS, MCT
> > > >
> > > >
> > > > "Graham" wrote:
> > > >
> > > > > Hi Ziad,
> > > > >
> > > > > I've copied the script into a .vbs file and changed the group name and OU
> > > > > name and then tried running the script but it came up with an error in line
> > > > > 11.
> > > > >
> > > > > Line 11 is as follows:
> > > > >
> > > > > Set objGroup = GetObject ("LDAP://"& strContainer & strDNSDomain)
> > > > >
> > > > > The Windows Script error is as follows:
> > > > >
> > > > > Line: 11
> > > > > Char: 1
> > > > > Error: 0x80005000
> > > > > Code: 80005000
> > > > > Source: (null)
> > > > >
> > > > > Sorry, I'm not a scripting person, so I can't really fault find on this.
> > > > >
> > > > > Any ideas what could be causing it.
> > > > >
> > > > > Many Thanks
> > > > >
> > > > > Graham
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "Ziad K. Chafi" wrote:
> > > > >
> > > > > > Hi Graham,
> > > > > > It is better solved using scripting, try the following script:
> > > > > >
> > > > > > Dim strMember, strDNSDomain, strContainer
> > > > > > Dim objGroup, objRootDSE
> > > > > > Dim arrMemberOf
> > > > > >
> > > > > > strContainer = "cn=TypeGroupNameHere, ou=TypeOUNameHere, "
> > > > > >
> > > > > > 'DO NOT CHANGE------------------------------------
> > > > > > Set objRootDSE = GetObject("LDAP://RootDSE")
> > > > > > strDNSDomain = objRootDSE.Get("DefaultNamingContext")
> > > > > >
> > > > > > Set objGroup = GetObject ("LDAP://"& strContainer & strDNSDomain)
> > > > > > objGroup.getInfo
> > > > > >
> > > > > > arrMemberOf = objGroup.GetEx("member")
> > > > > > '--------------------------------------------------
> > > > > >
> > > > > > Dim FSO, Writer
> > > > > > Set FSO = CreateObject("Scripting.FileSystemObject")
> > > > > > Set Writer = FSO.OpenTextFile("UsersInGroup.txt", 8, True)
> > > > > >
> > > > > > For Each strMember in arrMemberOf
> > > > > > Writer.WriteLine(strMember)
> > > > > > Next
> > > > > >
> > > > > > Writer.Close
> > > > > > Wscript.Quit
> > > > > >
> > > > > > Just copy this script to a .vbs file, change the group and OU names, save,
> > > > > > and just double click the file and you will get your list.
> > > > > >
> > > > > > Let me know...
> > > > > > --
> > > > > > Ziad K. Chafi
> > > > > > CompTIA A+, CompTIA N+, MCP, MCDST, MCAS: S, MCSE: S, MCDBA, MCTS, MCT
> > > > > >
> > > > > >
> > > > > > "Graham" wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > I am trying to export a list of users in a particular group so that it just
> > > > > > > gives me the names of the users in the group.
> > > > > > >
> > > > > > > I have done an export using the ldifde command but that gives the list with
> > > > > > > all the CN/OU/DC and the users logon information etc.
> > > > > > >
> > > > > > > I know it can be done using CSVE but am having trouble getting the right
> > > > > > > format.
> > > > > > >
> > > > > > > For example I want to export all users in a group named 'test users', the
> > > > > > > group is in an OU structure as follows:
> > > > > > >
> > > > > > > cn=test users,ou=users,ou=tier2,ou=tier3,dc=mycompany,dc=int
> > > > > > >
> > > > > > > Would appreciate any help.
> > > > > > >
> > > > > > > Thanks