Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Re: ADSI Script to check Computer name and Domain

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Re: ADSI Script to check Computer name and Domain
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
 Re: ADSI Script to check Computer name and Domain - 3/10/2005 5:18:35 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
I am just following further on the DC_Name in the query:
cmd.commandtext = "<LDAP://DC_Name/dc=subdomain,dc=mydomain,dc=com>;(&(objectcategory=computer)(objectclass=computer)(cn=" & host & "));cn;subtree"

The need to find out which DC to contact is essential because I need to use it in the query. If I use the same DC_name to query machines in AD on all my sites, then the search will not be efficient.

Eg. If before building a new machine, the person in Thailand needs to search in AD for the presence of the computername that he is building, will it not be be efficient if he searches on the Domain Controller AD box in Thailand, rather than searching the DC AD box based in NJ.

This is rather silly, but I guess in my VB SCript for the Win PE environment, I can add select case options based on all the options that the user can chose during the build process.

Case <If user choses domain=a.com>
NameofDC = "DCinADomain"

Case <If user choses domain=b.com>
NameofDC = "DCinBDomain"

..So forth and then I can use the NameofDC string in my query:

cmd.commandtext = "<LDAP://NameofDC/dc=subdomain,dc=mydomain,dc=com>;(&(objectcategory=computer)(objectclass=computer)(cn=" & host & "));cn;subtree"

Any thoughts?

(in reply to aek)
 
 
Post #: 21
 
 Re: ADSI Script to check Computer name and Domain - 3/10/2005 5:46:26 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
You didn't actually answer my question regarding the AD structure for your organization, but I guess that is not too important because I believe you just answered your own question :)

I have no exeprience with WinPE and can't really suggest on how you would approach it. But from what you describe, it sounds like a VERY practical and good suggestion. Or you could actually make different copies of CD based on the geographical location of the sites and distribute them to the regional site support.

(in reply to aek)
 
 
Post #: 22
 
 Re: ADSI Script to check Computer name and Domain - 3/10/2005 5:51:24 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
Thanks.

Really appreciate your input.

(in reply to aek)
 
 
Post #: 23
 
 Re: ADSI Script to check Computer name and Domain - 3/10/2005 5:53:23 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Again, you're very welcome :) Glad I could help :D

(in reply to aek)
 
 
Post #: 24
 
 RE: Re: ADSI Script to check Computer name and Domain - 12/13/2005 3:26:43 PM   
  jgabler

 

Posts: 2
Score: 0
Joined: 12/13/2005
Status: offline
When I attempt to use the Set root = GetObject("LDAP:") command under WinPE, I get an 'Invalid syntax' error.

Can anyone help?

(in reply to token)
 
 
Post #: 25
 
 RE: Re: ADSI Script to check Computer name and Domain - 12/14/2005 12:05:55 AM   
  mbouchard


Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
While I haven't done this so am not positive, have you enabled ADSI in PE?

Also, post your script and I can try to test it on my PE disk.  But please start a new thread, include your original question.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to jgabler)
 
 
Post #: 26
 
 
Page:  <<   < prev  1 [2]
 
  

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 >> Re: ADSI Script to check Computer name and Domain Page: <<   < prev  1 [2]
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