Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Where to find property values?

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Where to find property values?
  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 >>
 Where to find property values? - 4/5/2005 7:57:51 AM   
  Nick Ellson

 

Posts: 2
Score: 0
Joined: 4/5/2005
From: USA
Status: offline
I used to use the old WINMGT interface to query a domain or even AD acting as a domain for things like all compuer objects, then do some routine on each one I found.

Using MS's new scripting center I can see script samples that get me a list of all the computers in an LDAP query.. and then a script to get particular values from a computer object.. but that script required teh FQDN of the LDAP object..

What I am trying to grasp is how or where to I find the possible properties that can be used in calls like "objRecordSet.Fields("Name")" in the sample below that will yield the FQDN that could be used in an additional query for things like the dns suffix search order of each machine found? I tried ADsPath, DistinguishedName, nohing yields anything other than the PC's short name.

Nick

-------Sample ------------------
On Error Resume Next

Const ADS_SCOPE_SUBTREE = 2

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"

Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://DC=corp,DC=dom' " _
& "Where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst

Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name")

objRecordSet.MoveNext
Loop

_____________________________

--
Nick
 
 
Post #: 1
 
 Re: Where to find property values? - 4/5/2005 12:04:30 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
You could download the ADSI mmc snap-in from MS site and look at all avaialble attribute names.

Also, you LDAP doesn't support ADsPath, you will have to use distinguishedname for that.

eg:
objCommand.CommandText = _
"Select distinguishedname, Name, Location from 'LDAP://DC=corp,DC=dom' Where objectClass='computer'"

Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & objRecordSet.Fields("distinguishedname")
objRecordSet.MoveNext
Loop

which will show you the fully qualified ldap path for each computer objects.

(in reply to Nick Ellson)
 
 
Post #: 2
 
 Re: Where to find property values? - 4/6/2005 12:18:05 AM   
  Nick Ellson

 

Posts: 2
Score: 0
Joined: 4/5/2005
From: USA
Status: offline
OK, you have just turned on a light bulb that I was missing! I never made a correlation to the objRecordSet.Fields and the objCommand.CommandText... so I never had the DistingguishedName listed as an argument to collect, so my attempts at displaying the distiguished name always came up blank. Now they work! And tehre is an ADSI MMC snap in, eh? I will be grabbing that!!

What I can do now is use teh samples from the MS Script Center, and glue 1 or 2 together such that I can now loop through the tree and get all computer objects, and take the distiguished name field to feed to any other script segment that tells me things about each computer. My first task being to locate all machines that have bad suffix search orders statically set.

Thanks again! You helped a lot!

Nick

(in reply to Nick Ellson)
 
 
Post #: 3
 
 Re: Where to find property values? - 4/6/2005 4:36:44 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
No problem, glad I could help =)

(in reply to Nick Ellson)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Where to find property values? 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