Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Active Directory Query Template

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,40609
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Active Directory Query Template
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Active Directory Query Template - 12/7/2006 10:10:00 PM   
  ginolard


Posts: 1021
Score: 21
Joined: 8/10/2005
Status: offline
Here's an AD query template I use, pretty much, all the time.


      

< Message edited by ginolard -- 2/19/2007 8:43:06 PM >


_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm
 
 
Revisions: 2 | Post #: 1
 
 RE: Active Directory Query Template - 2/19/2007 8:46:48 PM   
  ginolard


Posts: 1021
Score: 21
Joined: 8/10/2005
Status: offline
I've updated the above script to make a little more user-friendly.  I've also added a few more query choices. 

If you can think of any other queries that you might need, let me know and I can add them easily.  A couple of notes
  • There is a small Function that can be used to test if a user's password has expired
  • You can have the output as comma-separated by commenting in the first Wscript.Echo line in the Do Loop of the main code
I really SHOULD convert this into an HTA....

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to ginolard)
 
 
Post #: 2
 
 RE: Active Directory Query Template - 3/6/2007 9:51:14 AM   
  Diversion

 

Posts: 1
Score: 0
Joined: 3/6/2007
Status: offline
How bout a query to list all group a userID is a part of?   Basically everything in the Members Of section in AD.

Jay

(in reply to ginolard)
 
 
Post #: 3
 
 RE: Active Directory Query Template - 3/25/2007 9:30:19 PM   
  ginolard


Posts: 1021
Score: 21
Joined: 8/10/2005
Status: offline
I prefer to have a separate script for that ;)

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to Diversion)
 
 
Post #: 4
 
 RE: Active Directory Query Template - 6/11/2007 9:43:00 PM   
  andy robinson

 

Posts: 2
Score: 0
Joined: 6/11/2007
Status: offline
Many thanks for that one, now the question is, can you do a script that would export to a csv,? just computer name, last logon to domain (date?) something like that.

after pressing the enter key for 543 computers, excuse spellink mistakes finger soar....



love these smileys

Andy

(in reply to ginolard)
 
 
Post #: 5
 
 RE: Active Directory Query Template - 6/11/2007 10:26:07 PM   
  ginolard


Posts: 1021
Score: 21
Joined: 8/10/2005
Status: offline
Well, I *could* but we're not here to write scripts for you ;)

Writing to a CSV file is easy.  You will need to read up the FileSystemObject and OpenTextFile/CreateTextFile

AD querying is a more complex subject admittedly but this template script should give you a fair understanding of how the query syntax is formed.  You will just need to find the field for lastlogontime (ADSIEDIT could do that for you)

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to andy robinson)
 
 
Post #: 6
 
 RE: Active Directory Query Template - 6/29/2007 11:17:12 AM   
  jrcochranusa


Posts: 25
Score: 0
Joined: 1/30/2007
Status: offline
Dude...this script is awesome...I use it for tons of stuff!!

Thanks,

_____________________________

Thanks,

jrc

(in reply to ginolard)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Active Directory Query Template Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts