That's not going to work then. You're basically going to have to do a
recursive loop through the sub-OU's. Its not pretty.

I've got a sample I wrote for pulling data out of an Exchange 5.5 directory
via LDAP using recursion. It might get you started:
http://www.wiredeuclid.com/modules.php?op=modload&name=Sections&file=index&r
eq=viewarticle&artid=2&page=1


--------------------------------------------------------------
Roger D. Seielstad - MTS MCSE MS-MVP
Sr. Systems Administrator
Inovis Inc.


> -----Original Message-----
> From: Weatherly, Rob [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 12:06 PM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> 
> Yes,
> But there are also several below it
> It is broken off into departments
> I have about 600 users under CorpHQ but they are mostly under a sub-OU
> There are actually only 10 or 15 that are actually right in the CorpHQ
> OU
> 
> --------------------------------
> Rob Weatherly
> --------------------------------
> 
> -----Original Message-----
> From: Evans Chris - cevans [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 11:55 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> Is CorpHQ the OU where the user accounts reside?
> 
> -----Original Message-----
> From: Weatherly, Rob [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 10:51 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> 
> I am using 
> "LDAP://OU=CorpHQ,DC=Handleman,DC=com";
> 
> I was wrong earlier
> I thought is was corp it is corphq
> --------------------------------
> Rob Weatherly
> --------------------------------
> 
> -----Original Message-----
> From: Evans Chris - cevans [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 11:46 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> What are you using for the 
> "LDAP://OU=Users,DC=YourDomain,DC=com"; line?
> 
> -----Original Message-----
> From: Weatherly, Rob [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 10:35 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> 
> Actually I lied 
> It does not write out the last logon time
> sorry
> 
> --------------------------------
> Rob Weatherly
> --------------------------------
> 
> -----Original Message-----
> From: Weatherly, Rob 
> Sent: Tuesday, July 15, 2003 11:31 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> If I change 'User.LastLogin' to 'User.LastLogon'
> 
> It works
> --------------------------------
> Rob Weatherly
> --------------------------------
> 
> -----Original Message-----
> From: Weatherly, Rob 
> Sent: Tuesday, July 15, 2003 11:29 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> No, I get an error at 
> Line: 5 
> Char: 3
> Error: Object doesn't support this property or method: 
> 'User.LastLogin'
> 
> 
> --------------------------------
> Rob Weatherly
> --------------------------------
> 
> -----Original Message-----
> From: Evans Chris - cevans [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 11:25 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> Does this work for you? You will need to change the first line to
> whatever
> OU your users are in.
> 
> On Error Resume Next
> Dim OU
> Set OU = GetObject("LDAP://OU=Users,DC=YourDomain,DC=com";)
> For Each User in OU
>       Wscript.Echo User.LastLogin & "," & User.distinguishedName & ","
> &
> user.name NEXT
> 
> -----Original Message-----
> From: Weatherly, Rob [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 10:03 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> 
> Using the original code from before (below)
> I get the following error
> Error:
> Line: 13
> Char: 6
> Error: the directory property cannot be found in the cache
> 
> Code: 8000500D
> Source: Active Directory
> 
> 'On Error Resume Next
> Dim Container
> Dim ContainerName
> Dim User
> Dim File
> Set FSO = Wscript.CreateObject("Scripting.FileSystemObject")
> Set File = FSO.CreateTextFile("LastLogin.csv")
> ContainerName = "handleman"
> Set Container = GetObject("WinNT://" & ContainerName) 
> Container.Filter = Array("User") 
> For Each User in Container
>      'Wscript.Echo User.name & " " & User.LastLogin
>      File.Writeline User.name & "," & user.LastLogin
>      Next
> 
> --------------------------------
> Rob Weatherly
> --------------------------------
> 
> -----Original Message-----
> From: Evans Chris - cevans [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 10:47 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> Right. They are all users not corps.  :-) a little humor 
> there. Although
> I
> sometimes think some of mine are corpse.
> 
> -----Original Message-----
> From: Roger Seielstad [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 9:40 AM
> To: NT 2000 Discussions
> Subject: RE: Active Directory query
> 
> 
> You are. The filter is meant to filter by object type, not by 
> container.
> If
> you want it by container, you can't use the ADSI style binding (i.e.
> WINNT://)
> 
> Comment out the on error resume next line and try it again. You're
> probably
> not binding to the domain correctly.
> 
> Is the NetBIOS name of your domain 'handleman' or is it 
> something else?
> 
> --------------------------------------------------------------
> Roger D. Seielstad - MTS MCSE MS-MVP
> Sr. Systems Administrator
> Inovis Inc.
> 
> 
> > -----Original Message-----
> > From: Weatherly, Rob [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, July 15, 2003 10:33 AM
> > To: NT 2000 Discussions
> > Subject: RE: Active Directory query
> > 
> > 
> > Well all of my users are in a OU named corp
> > If I am thinking the wrong thing, I will change it back
> > 
> > With Container.Filter = Array("Corp")
> > The following line works
> > FILE.Writeline User.name & "," & user.LastLogin
> > When I add user.dn as follows
> > FILE.Writeline User.name & "," & User.dn & "," & user.LastLogin It 
> > does not
> > 
> > When I change
> > Container.Filter = Array("Corp")
> > To
> > Container.Filter = Array("User")
> > It still writes out a 0 byte csv file
> > 
> > --------------------------------
> > Rob Weatherly
> > --------------------------------
> > 
> > -----Original Message-----
> > From: Evans Chris - cevans [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, July 15, 2003 10:23 AM
> > To: NT 2000 Discussions
> > Subject: RE: Active Directory query
> > 
> > Container.Filter = Array("Corp") should read Container.Filter =
> > Array("User")
> > 
> > -----Original Message-----
> > From: Weatherly, Rob [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, July 15, 2003 9:20 AM
> > To: NT 2000 Discussions
> > Subject: RE: Active Directory query
> > 
> > 
> > Ok I added it
> > The whole script is below
> > When I run it, it creates the file but buts nothing in the 
> file When 
> > the script finished I have a 0 byte file named LastLogon.csv
> > 
> > On Error Resume Next
> > Dim Container
> > Dim ContainerName
> > Dim User
> > Dim File
> > Set FSO = Wscript.CreateObject("Scripting.FileSystemObject")
> > Set File = FSO.CreateTextFile("LastLogin.csv")
> > ContainerName = "handleman"
> > Set Container = GetObject("WinNT://" & ContainerName) 
> Container.Filter
> 
> > = Array("Corp") For Each User in Container
> >      'Wscript.Echo User.name & " " & User.LastLogin
> >      FILE.Writeline User.name & "," & User.dn & "," & user.LastLogin
> >      Next
> > 
> > --------------------------------
> > Rob Weatherly
> > --------------------------------
> > 
> > -----Original Message-----
> > From: Roger Seielstad [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, July 15, 2003 10:14 AM
> > To: NT 2000 Discussions
> > Subject: RE: Active Directory query
> > 
> > Although asthetically, I'd put user.dn before user.lastlogin
> > 
> > --------------------------------------------------------------
> > Roger D. Seielstad - MTS MCSE MS-MVP
> > Sr. Systems Administrator
> > Inovis Inc.
> > 
> > 
> > > -----Original Message-----
> > > From: Evans Chris - cevans [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, July 15, 2003 10:14 AM
> > > To: NT 2000 Discussions
> > > Subject: RE: Active Directory query
> > > 
> > > 
> > > You got it.
> > > 
> > > -----Original Message-----
> > > From: Weatherly, Rob [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, July 15, 2003 9:12 AM
> > > To: NT 2000 Discussions
> > > Subject: RE: Active Directory query
> > > 
> > > 
> > > So the line should read
> > > FILE.Writeline User.name & "," & User.LastLogin & "," & user.dn
> > > 
> > > Ok here is a stupid question
> > > Where do I find these on my own?
> > > I know there are so many objects that can be users
> > > Is there any references or libraries where I can get a listing of
> > > some/all of them
> > > 
> > > --------------------------------
> > > Rob Weatherly
> > > --------------------------------
> > > 
> > > -----Original Message-----
> > > From: Evans Chris - cevans [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, July 15, 2003 10:04 AM
> > > To: NT 2000 Discussions
> > > Subject: RE: Active Directory query
> > > 
> > > Sure, use User.dn
> > > 
> > > -----Original Message-----
> > > From: Weatherly, Rob [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, July 15, 2003 9:02 AM
> > > To: NT 2000 Discussions
> > > Subject: RE: Active Directory query
> > > 
> > > 
> > > One other thing
> > > Is there a way I can add an output column that would show there
> > > container or full path to there OU/user account
> > > 
> > > --------------------------------
> > > Rob Weatherly
> > > --------------------------------
> > > 
> > > -----Original Message-----
> > > From: Weatherly, Rob
> > > Sent: Tuesday, July 15, 2003 8:52 AM
> > > To: NT 2000 Discussions
> > > Subject: RE: Active Directory query
> > > 
> > > Thank you guys that worked great
> > > I have exactly what I need
> > > Again thanks a lot
> > > 
> > > --------------------------------
> > > Rob Weatherly
> > > --------------------------------
> > > 
> > > -----Original Message-----
> > > From: Roger Seielstad [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, July 15, 2003 7:10 AM
> > > To: NT 2000 Discussions
> > > Subject: RE: Active Directory query
> > > 
> > > Change the file name to .csv ?? ;)
> > > 
> > > Actually, change the .txt to .csv, and replace the " " with ","
> > > 
> > > --------------------------------------------------------------
> > > Roger D. Seielstad - MTS MCSE MS-MVP
> > > Sr. Systems Administrator
> > > Inovis Inc.
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: Weatherly, Rob [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, July 14, 2003 4:38 PM
> > > > To: NT 2000 Discussions
> > > > Subject: RE: Active Directory query
> > > > 
> > > > 
> > > > Actually I have it running now
> > > > Instead of Set File = FSO.CreateTextFile("AllLastLogin.txt")
> > > > Is there a way I can output to a CSV file instead?
> > > > 
> > > > --------------------------------
> > > > Rob Weatherly
> > > > --------------------------------
> > > > 
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, July 14, 2003 4:43 PM
> > > > To: NT 2000 Discussions
> > > > Subject: RE: Active Directory query
> > > > 
> > > > Just a warning this will only find last logins for the DC
> > that you
> > > > logged into.  If you have more then one DC other users may
> > > be logging
> > > > into other DC's and the last login time is not replicated
> > > to the other
> > > 
> > > > DC's  If you only have more than one DC which you should
> > > you will want
> > > 
> > > > to check each one.  I you don't know how to manipulate 
> the script 
> > > > below I may be able to help ya out.
> > > > 
> > > > shaun gillissen
> > > > 
> > > > 
> > > >  
> > > > 
> > > >  
> > > > 
> > > >                                                         To:
> > >   "NT 2000
> > > > Discussions" <[EMAIL PROTECTED]>                            
> > > >                                                         
> > cc:   (bcc:
> > > > Shaun Gillissen/ANR/MS/PHILIPS)                         
>          
> > > >                                                         
> > > > Subject:    RE:
> > > > Active Directory query                                       
> > > >  
> > > > 
> > > >                Evans Chris - cevans                     
> > > > Classification:
> > > > 
> > > >                <[EMAIL PROTECTED]>
> > > > 
> > > >  
> > > > 
> > > >                Sent by:
> > > > 
> > > >                [EMAIL PROTECTED]
> > > > 
> > > >                .com
> > > > 
> > > >  
> > > > 
> > > >                07/14/2003 04:23 PM
> > > > 
> > > >                Please respond to "NT 2000
> > > > 
> > > >                Discussions"
> > > > 
> > > >  
> > > > 
> > > >  
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > On Error Resume Next
> > > > Dim Container
> > > > Dim ContainerName
> > > > Dim User
> > > > Dim File
> > > > Set FSO = Wscript.CreateObject("Scripting.FileSystemObject")
> > > > Set File = FSO.CreateTextFile("AllLastLogin.txt")
> > > > ContainerName = "Your Domain Here"
> > > > Set Container = GetObject("WinNT://" & ContainerName)
> > > Container.Filter
> > > 
> > > > = Array("User") For Each User in Container
> > > >      Wscript.Echo User.name & " " & User.LastLogin
> > > >      FILE.Writeline User.name & " Last logged on " &
> > User.LastLogin
> > > > Next
> > > > 
> > > > -----Original Message-----
> > > > From: Weatherly, Rob [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, July 14, 2003 3:02 PM
> > > > To: NT 2000 Discussions
> > > > Subject: Active Directory query
> > > > 
> > > > 
> > > > 
> > > > 
> > > > Does any one have a script or know where I can find a
> > > script that will
> > > 
> > > > show me users that have not logged on in the last 30 days
> > > Must work on
> > > > windows 2000 with active directory
> > > > 
> > > > 
> > > > --------------------------------
> > > > Rob Weatherly
> > > > --------------------------------
> > > > 
> > > > ------
> > > > You are subscribed as [EMAIL PROTECTED]
> > > > Web Interface: 
> > > > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> > > > t_mode=&la
> > > > ng=e
> > > > nglish
> > > > To unsubscribe send a blank email to %%email.unsub%%
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > 
> > 
> **********************************************************************
> > > > The information contained in this communication is
> > confidential, is
> > > > intended only for the use of the recipient named above,
> > and may be
> > > > legally privileged. If the reader of this message is not
> > > the intended
> > > > recipient, you are hereby notified that any dissemination, 
> > > > distribution, or copying of this communication is strictly 
> > > > prohibited. If you have received this communication in error, 
> > > > please re-send this communication to the sender and delete the 
> > > > original message or any copy of it from your computer system. 
> > > > Thank You.
> > > > 
> > > > 
> > > > ------
> > > > You are subscribed as [EMAIL PROTECTED]
> > > > Web Interface: 
> > > > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> > > t_mode=&la
> > > ng=english
> > >  To unsubscribe send a blank email to %%email.unsub%%
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ------
> > > You are subscribed as [EMAIL PROTECTED]
> > > Web Interface: 
> > > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> > > t_mode=&la
> > > ng=english
> > > To unsubscribe send a blank email to %%email.unsub%%
> > > 
> > > ------
> > > You are subscribed as [EMAIL PROTECTED]
> > > Web Interface: 
> > > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> > > t_mode=&la
> > > ng=e
> > > nglish
> > > To unsubscribe send a blank email to %%email.unsub%%
> > > 
> > > ------
> > > You are subscribed as [EMAIL PROTECTED]
> > > Web Interface: 
> > > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> > > t_mode=&la
> > > ng=english
> > > To unsubscribe send a blank email to %%email.unsub%%
> > > 
> > > ------
> > > You are subscribed as [EMAIL PROTECTED]
> > > Web Interface: 
> > > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> > t_mode=&la
> > ng=english
> > To unsubscribe send a blank email to %%email.unsub%%
> > 
> > ------
> > You are subscribed as [EMAIL PROTECTED]
> > Web Interface:
> > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> > t_mode=&la
> > ng=e
> > nglish
> > To unsubscribe send a blank email to %%email.unsub%%
> > 
> > 
> > 
> > 
> > 
> > 
> > ------
> > You are subscribed as [EMAIL PROTECTED]
> > Web Interface:
> > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> > t_mode=&la
> > ng=english
> > To unsubscribe send a blank email to %%email.unsub%%
> > 
> > ------
> > You are subscribed as [EMAIL PROTECTED]
> > Web Interface:
> > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> > t_mode=&la
> > ng=e
> > nglish
> > To unsubscribe send a blank email to %%email.unsub%%
> > 
> > 
> > 
> > 
> > 
> > 
> > ------
> > You are subscribed as [EMAIL PROTECTED]
> > Web Interface:
> > http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=e
> nglish
> To unsubscribe send a blank email to %%email.unsub%%
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=english
> To unsubscribe send a blank email to %%email.unsub%%
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=e
> nglish
> To unsubscribe send a blank email to %%email.unsub%%
> 
> 
> 
> 
> 
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=english
> To unsubscribe send a blank email to %%email.unsub%%
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=e
> nglish
> To unsubscribe send a blank email to %%email.unsub%%
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=e
> nglish
> To unsubscribe send a blank email to %%email.unsub%%
> 
> 
> 
> 
> 
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=english
> To unsubscribe send a blank email to %%email.unsub%%
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=e
> nglish
> To unsubscribe send a blank email to %%email.unsub%%
> 
> 
> 
> 
> 
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=english
> To unsubscribe send a blank email to %%email.unsub%%
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=english
> To unsubscribe send a blank email to %%email.unsub%%
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
> t_mode=&la
> ng=english
> To unsubscribe send a blank email to %%email.unsub%%
> 
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
> http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&tex
t_mode=&la
ng=e
nglish
To unsubscribe send a blank email to %%email.unsub%%






------
You are subscribed as [EMAIL PROTECTED]
Web Interface:
http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&text_mode=&la
ng=english
To unsubscribe send a blank email to %%email.unsub%%

------
You are subscribed as [EMAIL PROTECTED]
Web Interface:
http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&text_mode=&la
ng=e
nglish
To unsubscribe send a blank email to %%email.unsub%%






------
You are subscribed as [EMAIL PROTECTED]
Web Interface:
http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&text_mode=&la
ng=english
To unsubscribe send a blank email to %%email.unsub%%

------
You are subscribed as [EMAIL PROTECTED]
Web Interface:
http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&text_mode=&lang=e
nglish
To unsubscribe send a blank email to %%email.unsub%%

------
You are subscribed as [EMAIL PROTECTED]
Web Interface: 
http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&text_mode=&lang=english
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to