Thanks -----Original Message----- From: Kurt Buff [mailto:kurt.b...@gmail.com] Sent: Wednesday, May 19, 2010 3:07 PM To: NT System Admin Issues Subject: Re: Get User with Group membership in a file.
adfind -b ou=users,dc=imcu,dc=local -f "objectcategory=person" -csv -nodn displayname memberof > out.txt On Wed, May 19, 2010 at 10:57, David McSpadden <dav...@imcu.com> wrote: > > I have to get all my ad users and their group membership to a file and I have them in two CNs > > > > On Error Resume Next > > > > Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D > > > > Set objOU = GetObject _ > > ("LDAP://cn=Users,dc=imcu,dc=local") > > > > ObjOU.Filter= Array("user") > > > > For Each objUser in objOU > > WScript.Echo objUser.cn & " is a member of: " > > WScript.Echo vbTab & "Primary Group ID: " & _ > > objUser.Get("primaryGroupID") > > > > arrMemberOf = objUser.GetEx("memberOf") > > > > If Err.Number <> E_ADS_PROPERTY_NOT_FOUND Then > > For Each Group in arrMemberOf > > WScript.Echo vbTab & Group > > Next > > Else > > WScript.Echo vbTab & "memberOf attribute is not set" > > Err.Clear > > End If > > Wscript.Echo > > Next > > > > I also have a Cn No ScreenSaver Personnel. But when I put it into the above I get 0. > > > > Please consider the environment before printing this email. > > > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~