Skip to Content
Active Directory Cookbook
book

Active Directory Cookbook

by Robbie Allen
September 2003
Intermediate to advanced
624 pages
15h 49m
English
O'Reilly Media, Inc.
Content preview from Active Directory Cookbook

11.21. Forcing a Host to a Particular Site

Problem

You want to force a host to be in a particular site.

Solution

Using a graphical user interface

  1. Run regedit.exe from the command line or Start Run.

  2. Expand HKEY_LOCAL_MACHINE SYSTEM CurrentControlSet Services Netlogon Parameters.

  3. Right-click on Parameters and select New String Value.

  4. Enter SiteName for the name.

  5. Double-click on the new value, enter the name of the site under Value data, and click OK.

Using a command-line interface

> reg add HKLM\System\CurrentControlSet\Services\Netlogon\Parameters /v SiteName /t[RETURN] 
REG_SZ /d <SiteName>

Using VBScript

' This code forces the host the script is run on to use a particular host
' ------ SCRIPT CONFIGURATION ------
strSite = "<SiteName>"   ' e.g. Raleigh
' ------ END CONFIGURATION ---------

strNetlogonReg = "SYSTEM\CurrentControlSet\Services\Netlogon\Parameters"
const HKLM = &H80000002
set objReg = GetObject("winmgmts:root\default:StdRegProv")
objReg.SetStringValue HKLM, strNetlogonReg, "SiteName", strSite
WScript.Echo "Set SiteName to " & strSite

Discussion

You can bypass the part of the DC Locator process that determines a client’s site by hard-coding it in the Registry. This is generally not recommended and should primarily be used as a troubleshooting tool. If a client is experiencing authentication delays due to a misconfigured site or subnet object, you can hard-code its site so it temporarily points to a more optimal location (and domain controller).

See Also

Recipe 11.20 for ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Active Directory Administration Cookbook

Active Directory Administration Cookbook

Sander Berkouwer
Active Directory Cookbook, 3rd Edition

Active Directory Cookbook, 3rd Edition

Laura E. Hunter, Robbie Allen
Active Directory Cookbook, 4th Edition

Active Directory Cookbook, 4th Edition

Brian Svidergol, Robbie Allen

Publisher Resources

ISBN: 0596004648Supplemental ContentCatalog PageErrata