<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Computer Support &#187; Active directory</title>
	<atom:link href="http://www.xiitec.com/blog/category/system-administration/windows/active-directory-windows-system-administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xiitec.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 30 Dec 2009 08:40:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Checking Whether a Windows 2000 Domain Controller Can Be Upgraded to Windows Server 2003</title>
		<link>http://www.xiitec.com/blog/2009/01/02/checking-whether-a-windows-2000-domain-controller-can-be-upgraded-to-windows-server-2003/</link>
		<comments>http://www.xiitec.com/blog/2009/01/02/checking-whether-a-windows-2000-domain-controller-can-be-upgraded-to-windows-server-2003/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 00:51:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>
		<category><![CDATA[domain controller]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=233</guid>
		<description><![CDATA[Using a graphical user  interface
Insert a Windows Server 2003 CD into the Windows 2000 domain  controller or map a drive to the files contained on the CD. Run the following  command from the \i386 directory:
	&#62; winnt32 /checkupgradeonly
Using a command-line interface
To produce a compatibility report from the command line, first  you need [...]]]></description>
			<content:encoded><![CDATA[<h4>Using a graphical user  interface</h4>
<p>Insert a Windows Server 2003 CD into the Windows 2000 domain  controller or map a drive to the files contained on the CD. Run the following  command from the \<span class="docEmphasis">i386</span> directory:</p>
<pre>	&gt; winnt32 /checkupgradeonly</pre>
<h4>Using a command-line interface</h4>
<p>To produce a compatibility report from the command line, first  you need to create a text file containing the following <a title="idx-CHP-2-0262" name="idx-CHP-2-0262"></a>information:</p>
<pre>[Unattended]</pre>
<pre>Win9xUpgrade = Yes</pre>
<pre></pre>
<pre>[Win9xUpg]ReportOnly = Yes

SaveReportTo = "\\server1\upgradereports\"</pre>
<p>Save this file as <em>unattend.txt</em>, and then run the  following from the command-line:</p>
<pre>	&gt; winnt32 /checkupgradeonly /unattend:c:\unattend.txt</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2009/01/02/checking-whether-a-windows-2000-domain-controller-can-be-upgraded-to-windows-server-2003/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script: Displaying the Structure of a Forest</title>
		<link>http://www.xiitec.com/blog/2008/03/04/script-displaying-the-structure-of-a-forest/</link>
		<comments>http://www.xiitec.com/blog/2008/03/04/script-displaying-the-structure-of-a-forest/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 19:53:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>
		<category><![CDATA[forest]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=199</guid>
		<description><![CDATA[Do you know the structure of your Active Directory forest? You could use a tool such as ADSI Edit and expand all of the OUs and containers in each domain, but if you have a lot of OUs, this would be very time consuming.
With a pretty simple script, you can enumerate all the domains, OUs, [...]]]></description>
			<content:encoded><![CDATA[<p>Do you know the structure of your Active Directory forest? You could use a tool such as ADSI Edit and expand all of the OUs and containers in each domain, but if you have a lot of OUs, this would be very time consuming.</p>
<p>With a pretty simple script, you can enumerate all the domains, OUs, and containers in a forest. And you don&#8217;t need any type of privileged rights to do it. Here is the script:</p>
<p><span id="more-199"></span></p>
<pre>' This code prints out the forest tree hierarchy</pre>
<pre>' BEGIN SECTION 1
 set objRootDSE = GetObject("LDAP://RootDSE")
 strBase    =  "<ldap: cn="Partitions,">
               objRootDSE.Get("ConfigurationNamingContext") &amp; "&gt;;"
 strFilter  = "(&amp;(objectcategory=crossRef)(systemFlags=3));"
 strAttrs   = "name,trustParent,nCName,dnsRoot,distinguishedName;"
 strScope   = "onelevel"
 set objConn = CreateObject("ADODB.Connection")
 objConn.Provider = "ADsDSOObject"
 objConn.Open "Active Directory Provider"
 set objRS = objConn.Execute(strBase &amp; strFilter &amp; strAttrs &amp; strScope)
 objRS.MoveFirst
 ' END SECTION 1</ldap:></pre>
<pre>' BEGIN SECTION 2
 set dicSubDomainTrue = CreateObject("Scripting.Dictionary")
 set dicDomainHierarchy = CreateObject("Scripting.Dictionary")
 set dicDomainRoot = CreateObject("Scripting.Dictionary")
 ' END SECTION 2</pre>
<pre>' BEGIN SECTION 3
 while not objRS.EOF
    dicDomainRoot.Add objRS.Fields("name").Value, objRS.Fields("nCName").Value
    if objRS.Fields("trustParent").Value &lt;&gt; "" then
       dicSubDomainTrue.Add objRS.Fields("name").Value, 0
       set objDomainParent = GetObject("LDAP://" &amp; _
                             objRS.Fields("trustParent").Value)
       dicDomainHierarchy.Add objRS.Fields("name").Value, _
                              objDomainParent.Get("name")
    else
       dicSubDomainTrue.Add objRS.Fields("name").Value, 1
    end if
    objRS.MoveNext
 wend
 ' END SECTION 3</pre>
<pre>' BEGIN SECTION 4
 for each strDomain in dicSubDomainTrue
   if dicSubDomainTrue(strDomain) = 1 then
       DisplayDomains strDomain, "", dicDomainHierarchy, dicDomainRoot
   end if
 next</pre>
<pre>Function DisplayDomains ( strDomain, strSpaces, dicDomainHierachy, dicDomainRoot)
    WScript.Echo strSpaces &amp; strDomain
    DisplayObjects "LDAP://" &amp; dicDomainRoot(strDomain), "  " &amp; strSpaces
    for each strD in dicDomainHierarchy
       if dicDomainHierarchy(strD) = strDomain then
          DisplayDomains strD, "  " &amp; strSpaces, dicDomainHierarchy, _
                         dicDomainRoot
       end if
    next
 End Function</pre>
<pre>' DisplayObjects takes the ADsPath of the object to display
 ' child objects for and the number of spaces (indention) to
 ' use when printing the first parameter
 Function DisplayObjects( strADsPath, strSpace)
    set objObject = GetObject(strADsPath)
    Wscript.Echo strSpace &amp; objObject.Name
    objObject.Filter = Array("container","organizationalUnit")
    for each objChildObject in objObject
       DisplayObjects objChildObject.ADsPath, strSpace &amp; " "
    next
 End Function</pre>
<pre>' END SECTION 4</pre>
<p>Let&#8217;s walk through it.</p>
<p>In SECTION 1, I set up an ADO query to find all domains in a forest. This is a little trickier than you might imagine. Domains are represented in the Configuration naming context as crossRef objects; but since LDAP referrals can also be created as crossRef objects, I have to look for a specific type of crossRef object, ones that have a systemFlags attribute equal to 3. This signifies Active Directory domains.</p>
<p>In SECTION 2, I set up three dictionary objects that I&#8217;ll use throughout the script. Here is a brief overview of each dictionary object:</p>
<pre>dicSubDomainTrue</pre>
<p>This is used to identify whether domains contain subdomains. The keys will be domain names and values will be 0 if the domain has no subdomains or 1 if it does. This dictionary will be used later to enumerate the domain hierarchy.</p>
<pre>dicDomainHierarchy</pre>
<p>This is used to store the parent domain of a subdomain. The keys will be the domain names and the values will be each domain&#8217;s parent domain name.</p>
<pre>dicDomainRoot</pre>
<p>This is used to store the default naming context for each domain. The keys will be the domain names and the values will be the DN of each domain&#8217;s root.</p>
<p>In SECTION 3, I enumerate over each of the values returned by the ADO query started in SECTION 1. I first set the domain root in the dicDomainRoot dictionary. Next, I evaluate if the trustParent attribute contains a value. If it does, then I know the domain I&#8217;m currently on has a parent domain. If TRustParent does not contain a value, I know that it is the root domain of the forest or domain tree. If it does have a parent, I set an entry for the domain in dicSubDomainTrue to 0 to signify that I haven&#8217;t found a subdomain for this domain yet. I then set an entry in dicDomainHierarchy to contain the domain and parent domain as key value pairs.</p>
<p>At this point, I&#8217;ve set up all the data structures I need to start printing out the structure of a forest. In SECTION 4, I start iterating over each domain in the forest. I&#8217;ll enter only the domains that are roots of their forests. Then I call the DisplayDomains function. DisplayDomains prints the name of the current domain and calls DisplayObjects to print each container and organizationalUnit object in the domain. This effectively prints the structure of that domain. After it is done with that, it starts to loop over the keys in dicDomainHierarchy to find all child domains that have the current domain set as their parent. If it finds a subdomain of the current domain, it calls DisplayDomains (recursively) on that domain and the process repeats.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/03/04/script-displaying-the-structure-of-a-forest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling Diagnostics Logging</title>
		<link>http://www.xiitec.com/blog/2008/03/04/enabling-diagnostics-logging/</link>
		<comments>http://www.xiitec.com/blog/2008/03/04/enabling-diagnostics-logging/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 19:51:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>
		<category><![CDATA[diagnostic]]></category>
		<category><![CDATA[logging]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=198</guid>
		<description><![CDATA[A useful way to troubleshoot specific problems you are encountering with Active Directory is to increase the diagnostics logging level. Diagnostics logging can be enabled by component. For example, if you determine the KCC is not completing every 15 minutes, you can enable diagnostics logging for the one Knowledge Consistency Checker setting.

These settings are stored [...]]]></description>
			<content:encoded><![CDATA[<p>A useful way to troubleshoot specific problems you are encountering with Active Directory is to increase the diagnostics logging level. Diagnostics logging can be enabled by component. For example, if you determine the KCC is not completing every 15 minutes, you can enable diagnostics logging for the one Knowledge Consistency Checker setting.</p>
<p><span id="more-198"></span></p>
<p>These settings are stored under HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics. By default, all settings are set to 0, which disables diagnostic logging, but you can increase any one of them by setting it to a number from 1 through 5. As a general rule, a value of 1 is used for minimum logging, 3 for medium logging, and 5 for maximum logging. It is a good practice to ease your way up to 5 because some diagnostics logging settings can generate a huge number of events in the event log, which may make it difficult to read, along with increasing resource utilization on the domain controller.</p>
<p>Here is the complete list of diagnostics logging settings for Windows Server 2003. Note that settings 20-24 are not available on Windows 2000-based domain controllers.</p>
<pre>1 Knowledge Consistency Checker
 2 Security Events
 3 ExDS Interface Events
 4 MAPI Interface Events
 5 Replication Events
 6 Garbage Collection
 7 Internal Configuration
 8 Directory Access
 9 Internal Processing
 10 Performance Counters
 11 Initialization/Termination
 12 Service Control
 13 Name Resolution
 14 Backup
 15 Field Engineering
 16 LDAP Interface Events
 17 Setup
 18 Global Catalog
 19 Inter-site Messaging
 20 Group Caching
 21 Linked-Value Replication
 22 DS RPC Client
 23 DS RPC Server
 24 DS Schema</pre>
<p><strong>Using a graphical user interface</strong></p>
<ol>
<li> Run regedit.exe from the command line or Start  Run.</li>
<li>In the left pane, expand HKEY_LOCAL_MACHINE  System  CurrentControlSet  Services  NTDS  Diagnostics.</li>
<li>In the right pane, double-click on the diagnostics logging entry you want to increase, and enter a number (0-5) based on how much you want logged.</li>
<li>Click OK.</li>
</ol>
<p><strong>Using a command-line interface</strong></p>
<pre>&gt; reg add HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics /v "</pre>
<pre><loggingsetting>" /t REG_DWORD /d &lt;0-5&gt;</loggingsetting></pre>
<p><strong>Using VBScript</strong></p>
<pre>
' This code sets the specified diagnostics logging level
' ------ SCRIPT CONFIGURATION ------
strDC   = "<tt><em>&lt;DomainControllerName&gt;</em></tt>"  ' e.g., dc01
strLogSetting = "<tt><em>&lt;LoggingSetting&gt;</em></tt>"  ' e.g., 1 Knowledge Consistency Checker
intFlag = <tt><em>&lt;FlagValue&gt;              </em></tt> ' Flag value in decimal, e.g., 5
' ------ END CONFIGURATION ---------
const HKLM = &amp;H80000002
strRegKey = "SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics"
set objReg = GetObject("winmgmts:\\" &amp; strDC &amp; "\root\default:StdRegProv")
objReg.SetDwordValue HKLM, strRegKey, strLogSetting, intFlag
WScript.Echo "Diagnostics logging for " &amp; strLogSetting _
             &amp; " set to " &amp; intFlag</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/03/04/enabling-diagnostics-logging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Verifying and Resetting Trusts</title>
		<link>http://www.xiitec.com/blog/2008/03/03/verifying-and-resetting-trusts/</link>
		<comments>http://www.xiitec.com/blog/2008/03/03/verifying-and-resetting-trusts/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 21:08:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=197</guid>
		<description><![CDATA[Verifying a trust consists of checking connectivity between the domains, and determining if the shared secrets of a trust are synchronized between the two domains. Resetting a trust synchronizes the shared secrets (i.e., passwords) for the trust. The PDC role holder in both domains is used to synchronize the password so they must be reachable.

Using [...]]]></description>
			<content:encoded><![CDATA[<p>Verifying a trust consists of checking connectivity between the domains, and determining if the shared secrets of a trust are synchronized between the two domains. Resetting a trust synchronizes the shared secrets (i.e., passwords) for the trust. The PDC role holder in both domains is used to synchronize the password so they must be reachable.</p>
<p><span id="more-197"></span></p>
<p><strong>Using a graphical user interface</strong><br />
For the Windows 2000 version of the Active Directory Domains and Trusts snap-in:</p>
<ol>
<li>In the left pane, right-click on the trusting domain and select Properties.</li>
<li>Click the Trusts tab.</li>
<li>Click the domain that is associated with the trust you want to verify.</li>
<li>Click the Edit button.</li>
<li>Click the Verify button.</li>
<li>If the validation function fails, you&#8217;ll be given an option to reset the trust.</li>
</ol>
<p>For the Windows Server 2003 version of the Active Directory Domains and Trusts snap-in:</p>
<ol>
<li>In the left pane, right-click on the trusting domain and select Properties.</li>
<li>Click the Trusts tab.</li>
<li>Click the domain that is associated with the trust you want to verify.</li>
<li>Click the Properties button.</li>
<li>Click the Validate button.</li>
<li>If the validation function fails, you&#8217;ll be given an option to reset the trust.</li>
</ol>
<p><strong>Using a command-line interface</strong></p>
<p>The following command verifies a trust:</p>
<pre>&gt; netdom trust <tt><em>&lt;TrustingDomain&gt;</em></tt> /Domain:<tt><em>&lt;TrustedDomain&gt;</em></tt> /Verify /verbose
   [/UserO:<tt><em>&lt;TrustingDomainUser&gt;</em></tt> /PasswordO:*]
   [/UserD:<tt><em>&lt;TrustedDomainUser&gt;</em></tt> /PasswordD:*]
<trustingdomain>
<trusteddomain>
<trustingdomainuser>
<trusteddomainuser></trusteddomainuser></trustingdomainuser></trusteddomain></trustingdomain></pre>
<p>The following command resets a trust:</p>
<pre>&gt; netdom trust <tt><em>&lt;TrustingDomain&gt;</em></tt> /Domain:<tt><em>&lt;TrustedDomain&gt;</em></tt> /Verify /verbose
   [/UserO:<tt><em>&lt;TrustingDomainUser&gt;</em></tt> /PasswordO:*]
   [/UserD:<tt><em>&lt;TrustedDomainUser&gt;</em></tt> /PasswordD:*]</pre>
<trustingdomain>
<trusteddomain>
<trustingdomainuser>
<trusteddomainuser></trusteddomainuser></trustingdomainuser></trusteddomain></trustingdomain>Using VBScript</p>
<pre>
' The following code lists all of the trusts for the
' specified domain using the Trustmon WMI Provider.
' The Trustmon WMI Provider is supported only on Windows Server 2003.
' ------ SCRIPT CONFIGURATION ------
strDomain = "<tt><em>&lt;DomainDNSName&gt;</em></tt>"  ' e.g., amer.rallencorp.com
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" &amp; strDomain &amp; _
                       "\root\MicrosoftActiveDirectory")
set objTrusts = objWMI.ExecQuery("Select * from Microsoft_DomainTrustStatus")
for each objTrust in objTrusts
    Wscript.Echo objTrust.TrustedDomain
    Wscript.Echo " TrustedAttributes: " &amp; objTrust.TrustAttributes
    Wscript.Echo " TrustedDCName: "     &amp; objTrust.TrustedDCName
    Wscript.Echo " TrustedDirection: "  &amp; objTrust.TrustDirection
    Wscript.Echo " TrustIsOk: "         &amp; objTrust.TrustIsOK
    Wscript.Echo " TrustStatus: "       &amp; objTrust.TrustStatus
    Wscript.Echo " TrustStatusString: " &amp; objTrust.TrustStatusString
    Wscript.Echo " TrustType: "         &amp; objTrust.TrustType
    Wscript.Echo ""
next

' This code shows how to search specifically for trusts
' that have failed, which can be accomplished using a WQL query that
' contains the query: TrustIsOk = False
' ------ SCRIPT CONFIGURATION ------
strDomain = "<tt><em>&lt;DomainDNSName&gt;</em></tt>"  ' e.g., amer.rallencorp.com
' ------ END CONFIGURATION ---------

set objWMI = GetObject("winmgmts:\\" &amp; strDomain &amp; _
                       "\root\MicrosoftActiveDirectory")
set objTrusts = objWMI.ExecQuery("select * " _
                               &amp; " from Microsoft_DomainTrustStatus " _
                               &amp; " where TrustIsOk = False ")
if objTrusts.Count = 0 then
   Wscript.Echo "There are no trust failures"
else
   WScript.Echo "Trust Failures:"
   for each objTrust in objTrusts
      Wscript.Echo " " &amp; objTrust.TrustedDomain &amp; " : " &amp; _
                         objTrust.TrustStatusString
      Wscript.Echo ""
   next
end if

' This code resets the specified trust.
' ------ SCRIPT CONFIGURATION ------
' Set to the DNS or NetBIOS name for the Windows 2000,
' Windows NT domain or Kerberos realm you want to reset the trust for.
strTrustName = "<tt><em>&lt;TrustToCheck&gt;</em></tt>"

' Set to the DNS name of the source or trusting domain.
strDomain    = "<tt><em>&lt;TrustingDomain&gt;</em></tt>"
' ------ END CONFIGURATION ---------

' Enable SC_RESET during trust enumerations
set objTrustProv = GetObject("winmgmts:\\" &amp; strDomain &amp; _
              "\root\MicrosoftActiveDirectory:Microsoft_TrustProvider=@")
objTrustProv.TrustCheckLevel = 3  ' Enumerate with SC_RESET
objTrustProv.Put_

' Query the trust and print status information
set objWMI = GetObject("winmgmts:\\" &amp; strDomain &amp; _
                       "\root\MicrosoftActiveDirectory")
set objTrusts = objWMI.ExecQuery("Select * " _
                        &amp; " from Microsoft_DomainTrustStatus " _
                        &amp; " where TrustedDomain = '" &amp; strTrustName &amp; "'" )
for each objTrust in objTrusts
    Wscript.Echo objTrust.TrustedDomain
    Wscript.Echo " TrustedAttributes: " &amp; objTrust.TrustAttributes
    Wscript.Echo " TrustedDCName: "     &amp; objTrust.TrustedDCName
    Wscript.Echo " TrustedDirection: "  &amp; objTrust.TrustDirection
    Wscript.Echo " TrustIsOk: "         &amp; objTrust.TrustIsOK
    Wscript.Echo " TrustStatus: "       &amp; objTrust.TrustStatus
    Wscript.Echo " TrustStatusString: " &amp; objTrust.TrustStatusString
    Wscript.Echo " TrustType: "         &amp; objTrust.TrustType
    Wscript.Echo ""
next</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/03/03/verifying-and-resetting-trusts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Viewing the Trusts for a Domain</title>
		<link>http://www.xiitec.com/blog/2008/03/03/viewing-the-trusts-for-a-domain/</link>
		<comments>http://www.xiitec.com/blog/2008/03/03/viewing-the-trusts-for-a-domain/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 21:05:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=196</guid>
		<description><![CDATA[Using a graphical user interface

 Open the Active Directory Domains and Trusts snap-in.
In the left pane, right-click the domain you want to view and select Properties.
Click on the Trusts tab.

Using a command-line interface
&#62; netdom query trust /Domain:
Using VBScript
' This code prints the trusts for the specified domain.
' ------ SCRIPT CONFIGURATION ------
strDomain = ""   [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Using a graphical user interface</strong></p>
<ol>
<li> Open the Active Directory Domains and Trusts snap-in.</li>
<li>In the left pane, right-click the domain you want to view and select Properties.</li>
<li>Click on the Trusts tab.</li>
</ol>
<p><span id="more-196"></span><strong>Using a command-line interface</strong></p>
<pre>&gt; netdom query trust /Domain:<domaindnsname></domaindnsname></pre>
<p><strong>Using VBScript</strong></p>
<pre>' This code prints the trusts for the specified domain.</pre>
<pre>' ------ SCRIPT CONFIGURATION ------</pre>
<pre>strDomain = "<domaindnsname>"   ' e.g., rallencorp.com</domaindnsname></pre>
<pre><domaindnsname> ' ------ END CONFIGURATION ---------</domaindnsname></pre>
<pre>' Trust Direction Constants taken from NTSecAPI.h
 set objTrustDirectionHash = CreateObject("Scripting.Dictionary")
 objTrustDirectionHash.Add "DIRECTION_DISABLED", 0
 objTrustDirectionHash.Add "DIRECTION_INBOUND",  1
 objTrustDirectionHash.Add "DIRECTION_OUTBOUND", 2
 objTrustDirectionHash.Add "DIRECTION_BIDIRECTIONAL", 3</pre>
<pre>' Trust Type Constants - taken from NTSecAPI.h
 set objTrustTypeHash = CreateObject("Scripting.Dictionary")
 objTrustTypeHash.Add "TYPE_DOWNLEVEL", 1
 objTrustTypeHash.Add "TYPE_UPLEVEL", 2
 objTrustTypeHash.Add "TYPE_MIT", 3
 objTrustTypeHash.Add "TYPE_DCE", 4</pre>
<pre>' Trust Attribute Constants - taken from NTSecAPI.h
 set objTrustAttrHash = CreateObject("Scripting.Dictionary")
 objTrustAttrHash.Add "ATTRIBUTES_NON_TRANSITIVE", 1
 objTrustAttrHash.Add "ATTRIBUTES_UPLEVEL_ONLY", 2
 objTrustAttrHash.Add "ATTRIBUTES_QUARANTINED_DOMAIN", 4
 objTrustAttrHash.Add "ATTRIBUTES_FOREST_TRANSITIVE", 8
 objTrustAttrHash.Add "ATTRIBUTES_CROSS_ORGANIZATION", 16
 objTrustAttrHash.Add "ATTRIBUTES_WITHIN_FOREST", 32
 objTrustAttrHash.Add "ATTRIBUTES_TREAT_AS_EXTERNAL", 64</pre>
<pre>set objRootDSE = GetObject("LDAP://" &amp; strDomain &amp; "/RootDSE")
 set objTrusts  = GetObject("LDAP://cn=System," &amp; _
                             objRootDSE.Get("defaultNamingContext") )
 objTrusts.Filter = Array("trustedDomain")
 Wscript.Echo "Trusts for " &amp; strDomain &amp; ":"</pre>
<pre>for each objTrust in objTrusts
    for each strFlag In objTrustDirectionHash.Keys
       if objTrustDirectionHash(strFlag) = objTrust.Get("trustDirection") then
          strTrustInfo = strTrustInfo &amp; strFlag &amp; " "
       end If
    next</pre>
<pre>   for each strFlag In objTrustTypeHash.Keys
       if objTrustTypeHash(strFlag) = objTrust.Get("trustType") then
          strTrustInfo = strTrustInfo &amp; strFlag &amp; " "
       end If
    next</pre>
<pre>   for each strFlag In objTrustAttrHash.Keys
       if objTrustAttrHash(strFlag) = objTrust.Get("trustAttributes") then
          strTrustInfo = strTrustInfo &amp; strFlag &amp; " "
       end If
    next</pre>
<pre>   WScript.Echo " " &amp; objTrust.Get("trustPartner") &amp; " : " &amp; strTrustInfo
    strTrustInfo = ""
 next</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/03/03/viewing-the-trusts-for-a-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating and Removing a Trust</title>
		<link>http://www.xiitec.com/blog/2008/03/03/creating-and-removing-a-trust/</link>
		<comments>http://www.xiitec.com/blog/2008/03/03/creating-and-removing-a-trust/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 21:02:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=195</guid>
		<description><![CDATA[It is common when migrating from a Windows NT environment to Active Directory to set up trusts to down-level master account domains or resource domains. This allows AD users to access resources in the NT domains without providing alternate credentials. Windows NT does not support transitive trusts and therefore your only option is to create [...]]]></description>
			<content:encoded><![CDATA[<p>It is common when migrating from a Windows NT environment to Active Directory to set up trusts to down-level master account domains or resource domains. This allows AD users to access resources in the NT domains without providing alternate credentials. Windows NT does not support transitive trusts and therefore your only option is to create a nontransitive trust. That means you&#8217;ll need to set up individual trusts between the NT domain and every Active Directory domain that contains users that need to access the NT resources.</p>
<p><span id="more-195"></span></p>
<p>In Windows Server 2003, Active Directory introduced a new trust type called a forest trust. A forest trust allows you to create a single transitive trust between two forest root domains and have it apply to all subdomains. In Windows 2000 forests, you have to set up individual trusts between all the domains in one forest with all the domains in another.</p>
<p>Trusts are stored in Active Directory as two objects; a TRustedDomain object in the System container and a user object in the Users container. Both of these objects need to be removed when deleting a trust. The GUI and CLI solutions take care of that in one step, but in the VBScript example both objects needed to be explicitly deleted. It is also worth noting that each solution deleted only one side of the trust. If the trust was to a remote AD forest or NT 4.0 domain, you also need to delete the trust in that domain.</p>
<p><strong>Using a graphical user interface</strong></p>
<ol>
<li> Open the Active Directory Domains and Trusts snap-in.</li>
<li>In the left pane, right-click the domain you want to add a trust for and select Properties.</li>
<li>Click on the Trusts tab.</li>
<li>Click the New Trust button.</li>
<li>After the New Trust Wizard opens, click Next.</li>
<li>Complete the rest of the wizard steps. They will vary depending on the type of trust you create.</li>
</ol>
<p><strong>Using a command-line interface</strong></p>
<pre>&gt; netdom trust <targetdomainname> /Domain:<addomainname> /ADD</addomainname></targetdomainname></pre>
<pre><targetdomainname><addomainname>          [/UserD:<addomainname>\ADUser&gt; /PasswordD:*]</addomainname></addomainname></targetdomainname></pre>
<pre><targetdomainname><addomainname><addomainname>          [/UserO:<targetdomainname>\TargetUser&gt; /PasswordO:*]</targetdomainname></addomainname></addomainname></targetdomainname></pre>
<pre><targetdomainname><addomainname><addomainname><targetdomainname>          [/TwoWay]</targetdomainname></addomainname></addomainname></targetdomainname></pre>
<p>For example, to create a trust from the NT4 domain RALLENCORP_NT4 to the AD domain RALLENCORP, use the following command:</p>
<pre>&gt; netdom trust RALLENCORP_NT4 /Domain:RALLENCORP /ADD
          /UserD:RALLENCORP\administrator /PasswordD:*
          /UserO:RALLENCORP_NT4\administrator /PasswordO:*</pre>
<p>You can make the trust bidirectional, i.e., two-way, by adding a /TwoWay option to the example.</p>
<p>The following command deletes a trust:</p>
<pre>&gt; netdom trust <tt><em>&lt;TrustingDomain&gt;</em></tt> /Domain:<tt><em>&lt;TrustedDomain&gt;</em></tt> /Remove /verbose
   [/UserO:<tt><em>&lt;TrustingDomainUser&gt;</em></tt> /PasswordO:*]
   [/UserD:<tt><em>&lt;TrustedDomainUser&gt;</em></tt> /PasswordD:*]
<trustingdomain>
<trusteddomain>
<trustingdomainuser>
<trusteddomainuser></trusteddomainuser></trustingdomainuser></trusteddomain></trustingdomain></pre>
<p><strong>Using VBScript</strong></p>
<p>None of the scripting interfaces support the capability to create a trust, but you can delete them as shown here:</p>
<pre>' This code deletes a trust in the specified domain.
' ------ SCRIPT CONFIGURATION ------
' Set to the DNS or NetBIOS name for the Windows 2000,
' Windows NT domain or Kerberos realm trust you want to delete.
strTrustName = "<tt><em>&lt;TrustName&gt;</em></tt>"
' Set to the DNS name of the source or trusting domain
strDomain    = "<tt><em>&lt;DomainDNSName&gt;</em></tt>"
' ------ END CONFIGURATION ---------

set objRootDSE = GetObject("LDAP://" &amp; strDomain &amp; "/RootDSE")
set objTrust = GetObject("LDAP://cn=System," &amp; _
                         objRootDSE.Get("defaultNamingContext") )
objTrust.Delete "trustedDomain", "cn=" &amp; strTrustName
set objTrustUser = GetObject("LDAP://cn=Users," &amp; _
                         objRootDSE.Get("defaultNamingContext") )
objTrustUser.Delete "trustedDomain", "cn=" &amp; strTrustName &amp; "$"
WScript.Echo "Successfully deleted trust for " &amp; strTrustName</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/03/03/creating-and-removing-a-trust/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transferring or Seizing a FSMO Role</title>
		<link>http://www.xiitec.com/blog/2008/03/03/transferring-or-seizing-a-fsmo-rol/</link>
		<comments>http://www.xiitec.com/blog/2008/03/03/transferring-or-seizing-a-fsmo-rol/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 20:59:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=194</guid>
		<description><![CDATA[The first domain controller in a new forest is assigned the two forest-wide FSMO roles (schema and domain naming). The first domain controller in a new domain gets the other three domain-wide roles. It is very likely you&#8217;ll need to move the roles around to different domain controllers at some point. Also, when you need [...]]]></description>
			<content:encoded><![CDATA[<p>The first domain controller in a new forest is assigned the two forest-wide FSMO roles (schema and domain naming). The first domain controller in a new domain gets the other three domain-wide roles. It is very likely you&#8217;ll need to move the roles around to different domain controllers at some point. Also, when you need to take down a domain controller that is currently a FSMO role owner, you&#8217;ll want to transfer the role beforehand. If you plan to install a hotfix or do some other type of maintenance that necessitates only a quick reboot, you may not want to go to the trouble of transferring the FSMO role.</p>
<p><span id="more-194"></span></p>
<p>Some FSMO roles are more time critical than others. For example, the PDC Emulator role is used extensively, but the Schema Master is needed only when extending the schema. If a FSMO role owner becomes unavailable before you can transfer it, you&#8217;ll need to seize the role.</p>
<p>Seizing a FSMO role should not be done lightly. The general recommendation is to seize a FSMO role only when you cannot possibly bring the previous role holder back online. One reason that seizing a role is problematic is that you could possibly lose data. For example, let&#8217;s say that you extended the schema and immediately after it was extended, the Schema FSMO went down. If you could not bring that server back online, those extensions may have not replicated before the server went down. You would need to determine if the schema extensions replicated and, if not, re-extend the schema. A similar problem can result from losing the RID FSMO, where duplicate RID pools may be allocated.</p>
<p><strong>Using a graphical user interface</strong></p>
<ol>
<li> Use the same directions as described for viewing a specific FSMO, except target (i.e., right-click and select Connect to Domain Controller) the domain controller you want to transfer the FSMO to before selecting Operations Master.</li>
<li>Click the Change button.</li>
<li>Click OK twice.</li>
<li>You should then see a message stating whether the transfer was successful.</li>
</ol>
<p><strong>Using a command-line interface</strong><br />
The following transfers the PDC Emulator role to<newroleowner> </newroleowner></p>
<pre>&gt; ntdsutil roles conn "co t s <newroleowner>" q "TRansfer PDC" q q</newroleowner></pre>
<p>The following seizes the PDC Emulator role to run on <newroleowner>:</newroleowner></p>
<pre>&gt; ntdsutil roles conn "co t s <newroleowner>" q "seize PDC" q q</newroleowner></pre>
<p><strong>Using VBScript</strong></p>
<pre>' This code transfers the PDC Emulator role to the specified owner.</pre>
<pre>' ------ SCRIPT CONFIGURATION ------</pre>
<pre>strNewOwner = "<newroleowner>"  ' e.g., dc2.rallencorp.com</newroleowner></pre>
<pre><newroleowner> ' ------ END CONFIGURATION ---------</newroleowner></pre>
<pre><newroleowner> Set objRootDSE = GetObject("LDAP://" &amp; strNewOwner &amp; "/RootDSE")</newroleowner></pre>
<pre><newroleowner> objRootDSE.Put "becomePDC", 1</newroleowner></pre>
<pre><newroleowner> objRootDSE.SetInfo</newroleowner></pre>
<p>Seizing a FSMO role is typically not something you need to do programmatically, but you can do it. All you need to do is set the fSMORoleOwner attribute for the object that represents the FSMO role with the distinguished name of ntdSDSA object of the new role owner.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/03/03/transferring-or-seizing-a-fsmo-rol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding the FSMO Role Holders</title>
		<link>http://www.xiitec.com/blog/2008/03/03/finding-the-fsmo-role-holders/</link>
		<comments>http://www.xiitec.com/blog/2008/03/03/finding-the-fsmo-role-holders/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 20:56:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>
		<category><![CDATA[FSMO]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=193</guid>
		<description><![CDATA[Several Active Directory operations are sensitive, such as updating  the schema, and therefore need to be done on a single domain  controller. Active Directory cannot guarantee the proper execution of  these functions in a situation where they may be invoked from more than  one DC. The FSMO mechanism is used to [...]]]></description>
			<content:encoded><![CDATA[<p>Several Active Directory operations are sensitive, such as updating  the schema, and therefore need to be done on a single domain  controller. Active Directory cannot guarantee the proper execution of  these functions in a situation where they may be invoked from more than  one DC. The FSMO mechanism is used to limit these functions to a single  DC.</p>
<p><img src="http://www.xiitec.com/blog/wp-includes/js/tinymce/themes/advanced/images/spacer.gif" alt="More..." name="mce_plugin_wordpress_more" width="100%" height="10" id="mce_plugin_wordpress_more" title="More..." moretext="" /></p>
<p>There are five designated FSMO roles that correspond to these  sensitive functions. A FSMO role can apply either to an entire forest  or to a specific domain. Each role is stored in the fSMORoleOwner  attribute on various objects in Active Directory depending on the role.</p>
<table rules="all" width="100%" border="1" cellpadding="4" cellspacing="0">
<thead>
	</thead>
<tr>
<th scope="col">
<p>Role</p>
</th>
<th scope="col">
<p>Description</p>
</th>
<th scope="col">
<p>fSMORoleOwner location</p>
</th>
<th scope="col">
<p>Domain- or forest-wide?</p>
</th>
</tr>
<tr>
<td>
<p>Schema</p>
</td>
<td>
<p>Processes schema updates</p>
</td>
<td>
<p><a href="http://www.xiitec.com/blog/wp-admin/CN=Schema,CN=Configuration" mce_href="http://www.xiitec.com/blog/wp-admin/CN=Schema,CN=Configuration" target="_blank">CN=Schema,CN=Configuration</a>, <em>&lt;ForestDN&gt;</em></p>
</td>
<td>
<p>Forest</p>
</td>
</tr>
<tr>
<td>
<p>Domain Naming</p>
</td>
<td>
<p>Processes the addition, removal, and renaming of  domains</p>
</td>
<td>
<p><a href="http://www.xiitec.com/blog/wp-admin/CN=Partitions,CN=Configuration" mce_href="http://www.xiitec.com/blog/wp-admin/CN=Partitions,CN=Configuration" target="_blank">CN=Partitions,CN=Configuration</a>, <em>&lt;ForestDN&gt;</em></p>
</td>
<td>
<p>Forest</p>
</td>
</tr>
<tr>
<td>
<p>Infrastructure</p>
</td>
<td>
<p>Maintains references to objects in other domains</p>
</td>
<td>
<p><a href="http://www.xiitec.com/blog/wp-admin/CN=Infrastructure" mce_href="http://www.xiitec.com/blog/wp-admin/CN=Infrastructure" target="_blank">CN=Infrastructure</a>,<em>&lt;DomainDN&gt;</em></p>
</td>
<td>
<p>Domain</p>
</td>
</tr>
<tr>
<td>
<p>RID</p>
</td>
<td>
<p>Handles RID pool allocation for the domain controllers in a  domain</p>
</td>
<td>
<p><a href="http://www.xiitec.com/blog/wp-admin/CN=RidManager$,CN=System,%3C" mce_href="http://www.xiitec.com/blog/wp-admin/CN=RidManager$,CN=System,%3C" target="_blank">CN=RidManager$,  CN=System,&lt;</a><em>DomainDN&gt;</em></p>
</td>
<td>
<p>Domain</p>
</td>
</tr>
<tr>
<td>
<p>PDC Emulator</p>
</td>
<td>
<p>Acts as the domain master browser and as the PDC for downlevel  clients and Backup Domain Controllers (BDCs)</p>
</td>
<td>
<p><em>&lt;DomainDN&gt;</em></p>
</td>
<td>
<p>Domain</p>
</td>
</tr>
<tr>
<td></thead>
</td>
</tr>
</table>
<p><strong>Using a graphical user interface</strong></p>
<p>For the Schema Master:</p>
<ol>
<li>Open the Active Directory Schema snap-in.</li>
<li>Right-click on Active Directory Schema in the left pane and select Operations Master.</li>
</ol>
<p>For the Domain Naming Master:</p>
<ol>
<li>Open the Active Directory Domains and Trusts snap-in.</li>
<li>Right-click on Active Directory Domains and Trusts in the left pane and select Operations Master.</li>
</ol>
<p>For the PDC Emulator, RID Master, and Infrastructure Master:</p>
<ol>
<li>Open the Active Directory Users and Computers snap-in.</li>
<li>Make sure you&#8217;ve targeted the correct domain.</li>
<li>Right-click on Active Directory Users and Computers in the left pane and select Operations Master.</li>
<li>There are individual tabs for the PDC, RID, and Infrastructure roles.</li>
</ol>
<p><strong>Using a command-line interface</strong></p>
<p>In the following command, you can leave out the /Domain  option to query the domain in which you are currently logged on:</p>
<pre>&gt; netdom query fsmo /Domain:</pre>
<p>You can also use the dsquery server command to list the FSMO role owners as shown here where  can be schema, name, infr, pdc, or rid:</p>
<pre>&gt; dsquery server -hasfsmo </pre>
<p><strong>Using VBScript</strong></p>
<pre>' This code prints the FSMO role owners for the specified domain.</pre>
<pre>' ------ SCRIPT CONFIGURATION ------</pre>
<pre>strDomain = &quot;&quot;  ' e.g., emea.rallencorp.com</pre>
<pre> ' ------ END CONFIGURATION ---------</pre>
<pre>set objRootDSE = GetObject(&quot;LDAP://&quot; &amp; strDomain &amp; &quot;/RootDSE&quot;) strDomainDN  = objRootDSE.Get(&quot;defaultNamingContext&quot;) strSchemaDN = objRootDSE.Get(&quot;schemaNamingContext&quot;) strConfigDN = objRootDSE.Get(&quot;configurationNamingContext&quot;)</pre>
<pre>' PDC Emulator set objPDCFsmo = GetObject(&quot;LDAP://&quot; &amp; strDomainDN) Wscript.Echo &quot;PDC Emulator: &quot; &amp; objPDCFsmo.fsmoroleowner</pre>
<pre>' RID Master set objRIDFsmo = GetObject(&quot;LDAP://cn=RID Manager$,cn=system,&quot; &amp; strDomainDN) Wscript.Echo &quot;RID Master: &quot; &amp; objRIDFsmo.fsmoroleowner</pre>
<pre>' Schema Master set objSchemaFsmo = GetObject(&quot;LDAP://&quot; &amp; strSchemaDN) Wscript.Echo &quot;Schema Master: &quot; &amp; objSchemaFsmo.fsmoroleowner</pre>
<pre>' Infrastructure Master set objInfraFsmo = GetObject(&quot;LDAP://cn=Infrastructure,&quot; &amp; strDomainDN) Wscript.Echo &quot;Infrastructure Master: &quot; &amp; objInfraFsmo.fsmoroleowner</pre>
<pre>' Domain Naming Master set objDNFsmo = GetObject(&quot;LDAP://cn=Partitions,&quot; &amp; strConfigDN) Wscript.Echo &quot;Domain Naming Master: &quot; &amp; objDNFsmo.fsmoroleowner</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/03/03/finding-the-fsmo-role-holders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling and Disabling the Global Catalog</title>
		<link>http://www.xiitec.com/blog/2008/03/03/enabling-and-disabling-the-global-catalog/</link>
		<comments>http://www.xiitec.com/blog/2008/03/03/enabling-and-disabling-the-global-catalog/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 20:52:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>
		<category><![CDATA[global catalog]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=192</guid>
		<description><![CDATA[The first domain controller promoted into a forest is by default also made a global catalog server. If you want additional servers to contain the global catalog, you have to enable it. The global catalog on a domain controller becomes enabled when the low-order bit on the options attribute on the ntdSDSA object under the [...]]]></description>
			<content:encoded><![CDATA[<p>The first domain controller promoted into a forest is by default also made a global catalog server. If you want additional servers to contain the global catalog, you have to enable it. The global catalog on a domain controller becomes enabled when the low-order bit on the options attribute on the ntdSDSA object under the server object for the domain controller is set to 1. The DN of this object for dc1 in the Default-First-Site-Name site looks like this: cn=NTDSSettings,cn=DC1,cn=Default-First-Site-Name,cn=Sites,cn=Configuration, dc=rallencorp,dc=com.</p>
<p><span id="more-192"></span></p>
<p>After enabling the global catalog, it can take some time before the domain controller can start serving as a global catalog server. The length of time is based on the amount of data that needs to replicate and the type of connectivity between the domain controller&#8217;s replication partners. Once a server has completed initial replication of the global catalog, the isGlobalCatalogReady attribute in the RootDSE will be marked TRUE. Another way to determine if a domain controller has been at least flagged to become a global catalog is by checking if the options attribute on the ntdSDSA object for the server has been set to 1. Note that this does not necessarily mean the server is accepting requests as a global catalog. After replication is complete, you should see Event 1119 in the Directory Services log stating the server is advertising itself as a global catalog. At that point, you should also be able to perform LDAP queries against port 3268 on that server.</p>
<p>If you have Exchange installed in the forest, you&#8217;ll also need to reboot the server before it will be used as a global catalog by Exchange servers and clients.</p>
<p><strong>Using a graphical user interface</strong></p>
<ol>
<li> Open the Active Directory Sites and Services snap-in.</li>
<li>Browse to the nTDSDSA object (NtdS Settings) underneath the server object for the domain controller whose global catalog you want to enable or disable.</li>
<li>Right-click on NTDS Settings and select Properties.</li>
<li>Under the General tab, check (to enable) or uncheck (to disable) the box beside Global Catalog.</li>
<li>Click OK.</li>
</ol>
<p><strong>Using a command-line interface</strong></p>
<p>In the following command, <serverobjectdn> should be the server object DN, not the DN of the ntdSDSA object:</serverobjectdn></p>
<pre>&gt; dsmod server "<serverobjectdn>" -isgc yes|no</serverobjectdn></pre>
<p>For example, the following command enables the global catalog on dc1 in the Raleigh site:</p>
<pre>&gt; dsmod server "cn=DC1,cn=servers,cn=Raleigh,cn=sites,cn=configuration,dc=rallencorp,dc=com"
 -isgc yes</pre>
<p><strong>Using VBScript</strong></p>
<pre>' This code enables or disables the GC for the specified DC
 ' ------ SCRIPT CONFIGURATION ------
 strDC = "<domaincontrollername>"   ' e.g., dc01.rallencorp.com
 strGCEnable = 1                    ' 1 = enable, 0 = disable
 ' ------ END CONFIGURATION ---------</domaincontrollername></pre>
<pre>set objRootDSE = GetObject("LDAP://" &amp; strDC &amp; "/RootDSE")
 objNTDS = GetObject("LDAP://" &amp; strDC &amp; "/" &amp;  _
                     objRootDSE.Get("dSServiceName"))
 objNTDS.Put "options", strGCEnable
 objNTDS.SetInfo</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/03/03/enabling-and-disabling-the-global-catalog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding the Closest Domain Controller</title>
		<link>http://www.xiitec.com/blog/2008/02/28/finding-the-closest-domain-controller/</link>
		<comments>http://www.xiitec.com/blog/2008/02/28/finding-the-closest-domain-controller/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 23:24:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Active directory]]></category>
		<category><![CDATA[domain controller]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=191</guid>
		<description><![CDATA[The DC locator process as described in MS KB 314861 and MS KB 247811 defines how clients find the closest domain controller. The process uses the site topology stored in Active Directory to calculate the site where a particular client is. After the client site has been identified, it is a matter of finding a [...]]]></description>
			<content:encoded><![CDATA[<p>The DC locator process as described in MS KB 314861 and MS KB 247811 defines how clients find the closest domain controller. The process uses the site topology stored in Active Directory to calculate the site where a particular client is. After the client site has been identified, it is a matter of finding a domain controller that is either a member of that same site or that is covering that site.</p>
<p><span id="more-191"></span></p>
<p>The Microsoft DsGetDcName Directory Services API method implements the DC Locator process, but unfortunately cannot be used directly from a scripting language, such as VBScript. The IADsTools interface provides a wrapper around DsGetDcName, which is what I used. The nltest /dsgetdc command is also a wrapper around the DsGetDcName method, and is a handy tool when troubleshooting client issues related to finding an optimal domain controller.</p>
<p><strong>Using a command-line interface</strong></p>
<p>The following command finds the closest domain controller in the specified domain (<domaindnsname>). By default, it will return the DC closest to the computer nltest is being run from, but you can optionally use the /server option to target a remote computer. You can also optionally specify the /site option to find a domain controller that belongs to a particular site.</domaindnsname></p>
<pre>&gt; nltest /dsgetdc:<domaindnsname> [/site:<sitename>] [/server:<clientname>]</clientname></sitename></domaindnsname></pre>
<p><strong>Using VBScript</strong></p>
<pre>' This code finds the closest domain controller in the domain
 ' that the computer running the script is in.
 ' ------ SCRIPT CONFIGURATION ------
 strDomain = "<domaindnsname>"  ' e.g., emea.rallencorp.com
 ' ------ END CONFIGURATION ---------</domaindnsname></pre>
<pre>set objIadsTools = CreateObject("IADsTools.DCFunctions")
 objIadsTools.DsGetDcName( Cstr(strDomain) )
 Wscript.Echo "DC: " &amp; objIadsTools.DCName
 Wscript.Echo "DC Site: " &amp; objIadsTools.DCSiteName
 Wscript.Echo "Client Site: " &amp; objIadsTools.ClientSiteName</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/02/28/finding-the-closest-domain-controller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
