| Author | Messages | |
indym79
Posts:3
 | | 06/08/2009 4:57 PM |
| When using the code below available from http://techtasks.com/code/viewbookcode/1449 its giving me a DC in another site but my current site has a DC in it. The DC in my local site shows as my logon server when using echo %logonserver% at the command line.
How can I fix the AD sites so that each site reports its own DC which obviously is the closest DC.
We have 9 sites in ad which represent each city, each site/city has its own DC.
' This VBScript code finds the closest domain controller in the domain ' that the computer running the script is in.
' --------------------------------------------------------------- ' From the book "Active Directory Cookbook" by Robbie Allen ' Publisher: O'Reilly and Associates ' ISBN: 0-596-00466-4 ' Book web site: http://rallenhome.com/books/adcookbook/code.html ' ---------------------------------------------------------------
' ------ SCRIPT CONFIGURATION ------ strDomain = "<DomainDNSName>" ' e.g. emea.rallencorp.com ' ------ END CONFIGURATION ---------
set objIadsTools = CreateObject("IADsTools.DCFunctions") objIadsTools.DsGetDcName( Cstr(strDomain) ) Wscript.Echo "DC: " & objIadsTools.DCName Wscript.Echo "DC Site: " & objIadsTools.DCSiteName Wscript.Echo "Client Site: " & objIadsTools.ClientSiteName
| | | |
| rkaramchand
Posts:76
 | | 06/08/2009 4:59 PM |
| What do u get when u run nltest /DSGETDC:domain name
From: activedir-owner@mail.activedir.org [mailto:activedir-owner@mail.activedir.org] On Behalf Of Jason Zaring Sent: Monday, June 08, 2009 11:56 AM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Finding Closest DC
When using the code below available from http://techtasks.com/code/viewbookcode/1449 its giving me a DC in another site but my current site has a DC in it. The DC in my local site shows as my logon server when using echo %logonserver% at the command line.
How can I fix the AD sites so that each site reports its own DC which obviously is the closest DC.
We have 9 sites in ad which represent each city, each site/city has its own DC.
' This VBScript code finds the closest domain controller in the domain
' that the computer running the script is in.
' ---------------------------------------------------------------
' From the book "Active Directory Cookbook" by Robbie Allen
' Publisher: O'Reilly and Associates
' ISBN: 0-596-00466-4
' Book web site: http://rallenhome.com/books/adcookbook/code.html
' ---------------------------------------------------------------
' ------ SCRIPT CONFIGURATION ------
strDomain = "<DomainDNSName>" ' e.g. emea.rallencorp.com<http://emea.rallencorp.com>
' ------ END CONFIGURATION ---------
set objIadsTools = CreateObject("IADsTools.DCFunctions")
objIadsTools.DsGetDcName( Cstr(strDomain) )
Wscript.Echo "DC: " & objIadsTools.DCName
Wscript.Echo "DC Site: " & objIadsTools.DCSiteName
Wscript.Echo "Client Site: " & objIadsTools.ClientSiteName
| | | |
| pbbergs
Posts:281
 | | 06/08/2009 5:18 PM |
| My first thought would be to verify that you have your IP addresses within each site configured correctly within ADSS.
Best Practice http://technet.microsoft.com/en-us/library/cc755768.aspx
Thanks
Paul
From: activedir-owner@mail.activedir.org [mailto:activedir-owner@mail.activedir.org] On Behalf Of Jason Zaring Sent: Monday, June 08, 2009 10:56 AM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Finding Closest DC
When using the code below available from http://techtasks.com/code/viewbookcode/1449 its giving me a DC in another site but my current site has a DC in it. The DC in my local site shows as my logon server when using echo %logonserver% at the command line.
How can I fix the AD sites so that each site reports its own DC which obviously is the closest DC.
We have 9 sites in ad which represent each city, each site/city has its own DC.
' This VBScript code finds the closest domain controller in the domain
' that the computer running the script is in.
' ---------------------------------------------------------------
' From the book "Active Directory Cookbook" by Robbie Allen
' Publisher: O'Reilly and Associates
' ISBN: 0-596-00466-4
' Book web site: http://rallenhome.com/books/adcookbook/code.html
' ---------------------------------------------------------------
' ------ SCRIPT CONFIGURATION ------
strDomain = "<DomainDNSName>" ' e.g. emea.rallencorp.com<http://emea.rallencorp.com>
' ------ END CONFIGURATION ---------
set objIadsTools = CreateObject("IADsTools.DCFunctions")
objIadsTools.DsGetDcName( Cstr(strDomain) )
Wscript.Echo "DC: " & objIadsTools.DCName
Wscript.Echo "DC Site: " & objIadsTools.DCSiteName
Wscript.Echo "Client Site: " & objIadsTools.ClientSiteName
| | | |
| indym79
Posts:3
 | | 06/08/2009 5:45 PM |
| Using this reports the correct DC and site.
On Mon, Jun 8, 2009 at 11:59 AM, Chauhan, Rajeev <Rajeev.Chauhan@hud.gov>wrote:
> What do u get when u run nltest /DSGETDC:domain name > > > > > > *From:* activedir-owner@mail.activedir.org [mailto: > activedir-owner@mail.activedir.org] *On Behalf Of *Jason Zaring > *Sent:* Monday, June 08, 2009 11:56 AM > *To:* ActiveDir@mail.activedir.org > *Subject:* [ActiveDir] Finding Closest DC > > > > When using the code below available from > http://techtasks.com/code/viewbookcode/1449 its giving me a DC in another > site but my current site has a DC in it. The DC in my local site shows as > my logon server when using echo %logonserver% at the command line. > > How can I fix the AD sites so that each site reports its own DC which > obviously is the closest DC. > > We have 9 sites in ad which represent each city, each site/city has its own > DC. > > ' This VBScript code finds the closest domain controller in the domain > > ' that the computer running the script is in. > > > ' --------------------------------------------------------------- > > ' From the book "Active Directory Cookbook" by Robbie Allen > > ' Publisher: O'Reilly and Associates > > ' ISBN: 0-596-00466-4 > > ' Book web site: http://rallenhome.com/books/adcookbook/code.html > > ' --------------------------------------------------------------- > > > > ' ------ SCRIPT CONFIGURATION ------ > > strDomain = "<DomainDNSName>" ' e.g. emea.rallencorp.com > > ' ------ END CONFIGURATION --------- > > > set objIadsTools = CreateObject("IADsTools.DCFunctions") > > objIadsTools.DsGetDcName( Cstr(strDomain) ) > > Wscript.Echo "DC: " & objIadsTools.DCName > > Wscript.Echo "DC Site: " & objIadsTools.DCSiteName > > Wscript.Echo "Client Site: " & objIadsTools.ClientSiteName > > >
| | | |
| rkaramchand
Posts:76
 | | 06/08/2009 6:19 PM |
| There are no overlapping subnets
From: activedir-owner@mail.activedir.org [mailto:activedir-owner@mail.activedir.org] On Behalf Of Jason Zaring Sent: Monday, June 08, 2009 12:48 PM To: activedir@mail.activedir.org Subject: Re: [ActiveDir] Finding Closest DC
Paul, all subnets are setup and associated to the sites correctly. On Mon, Jun 8, 2009 at 12:18 PM, Paul Bergson (ALLETE) <pbergson@allete.com<mailto:pbergson@allete.com>> wrote:
My first thought would be to verify that you have your IP addresses within each site configured correctly within ADSS.
Best Practice
http://technet.microsoft.com/en-us/library/cc755768.aspx
Thanks
Paul
From: activedir-owner@mail.activedir.org<mailto:activedir-owner@mail.activedir.org> [mailto:activedir-owner@mail.activedir.org<mailto:activedir-owner@mail.activedir.org>] On Behalf Of Jason Zaring Sent: Monday, June 08, 2009 10:56 AM
To: ActiveDir@mail.activedir.org<mailto:ActiveDir@mail.activedir.org> Subject: [ActiveDir] Finding Closest DC
When using the code below available from http://techtasks.com/code/viewbookcode/1449 its giving me a DC in another site but my current site has a DC in it. The DC in my local site shows as my logon server when using echo %logonserver% at the command line.
How can I fix the AD sites so that each site reports its own DC which obviously is the closest DC.
We have 9 sites in ad which represent each city, each site/city has its own DC.
' This VBScript code finds the closest domain controller in the domain
' that the computer running the script is in.
' ---------------------------------------------------------------
' From the book "Active Directory Cookbook" by Robbie Allen
' Publisher: O'Reilly and Associates
' ISBN: 0-596-00466-4
' Book web site: http://rallenhome.com/books/adcookbook/code.html
' ---------------------------------------------------------------
' ------ SCRIPT CONFIGURATION ------
strDomain = "<DomainDNSName>" ' e.g. emea.rallencorp.com<http://emea.rallencorp.com>
' ------ END CONFIGURATION ---------
set objIadsTools = CreateObject("IADsTools.DCFunctions")
objIadsTools.DsGetDcName( Cstr(strDomain) )
Wscript.Echo "DC: " & objIadsTools.DCName
Wscript.Echo "DC Site: " & objIadsTools.DCSiteName
Wscript.Echo "Client Site: " & objIadsTools.ClientSiteName
| | | |
| indym79
Posts:3
 | | 06/08/2009 7:20 PM |
| I think I have it all working correctly now. I edited the Site Link and created one for each city that included the city and the home office only. The original default site link was setup to have all cities in it at one time.
I waited for that to replicate to each office then checked it all again and now the script is seeing the correct DC.
On Mon, Jun 8, 2009 at 1:17 PM, Chauhan, Rajeev <Rajeev.Chauhan@hud.gov>wrote:
> There are no overlapping subnets > > > > > > *From:* activedir-owner@mail.activedir.org [mailto: > activedir-owner@mail.activedir.org] *On Behalf Of *Jason Zaring > *Sent:* Monday, June 08, 2009 12:48 PM > *To:* activedir@mail.activedir.org > *Subject:* Re: [ActiveDir] Finding Closest DC > > > > Paul, all subnets are setup and associated to the sites correctly. > > On Mon, Jun 8, 2009 at 12:18 PM, Paul Bergson (ALLETE) < > pbergson@allete.com> wrote: > > My first thought would be to verify that you have your IP addresses within > each site configured correctly within ADSS. > > > > > > Best Practice > > http://technet.microsoft.com/en-us/library/cc755768.aspx > > > > > > > > Thanks > > > > Paul > > > > > > *From:* activedir-owner@mail.activedir.org [mailto: > activedir-owner@mail.activedir.org] *On Behalf Of *Jason Zaring > *Sent:* Monday, June 08, 2009 10:56 AM > > > *To:* ActiveDir@mail.activedir.org > *Subject:* [ActiveDir] Finding Closest DC > > > > When using the code below available from > http://techtasks.com/code/viewbookcode/1449 its giving me a DC in another > site but my current site has a DC in it. The DC in my local site shows as > my logon server when using echo %logonserver% at the command line. > > > > How can I fix the AD sites so that each site reports its own DC which > obviously is the closest DC. > > We have 9 sites in ad which represent each city, each site/city has its own > DC. > > ' This VBScript code finds the closest domain controller in the domain > > > > ' that the computer running the script is in. > > > > ' --------------------------------------------------------------- > > ' From the book "Active Directory Cookbook" by Robbie Allen > > ' Publisher: O'Reilly and Associates > > > > ' ISBN: 0-596-00466-4 > > ' Book web site: http://rallenhome.com/books/adcookbook/code.html > > ' --------------------------------------------------------------- > > > > > > ' ------ SCRIPT CONFIGURATION ------ > > strDomain = "<DomainDNSName>" ' e.g. emea.rallencorp.com > > ' ------ END CONFIGURATION --------- > > > > set objIadsTools = CreateObject("IADsTools.DCFunctions") > > > > objIadsTools.DsGetDcName( Cstr(strDomain) ) > > Wscript.Echo "DC: " & objIadsTools.DCName > > Wscript.Echo "DC Site: " & objIadsTools.DCSiteName > > Wscript.Echo "Client Site: " & objIadsTools.ClientSiteName > > > > > > >
| | | |
|
|