index
int64
0
4.08k
text
stringlengths
34
4.9k
url
stringclasses
38 values
96
3.10. Removing an Unsuccessfully Demoted Domain Controller Problem You want to manually remove a domain controller from Active Directory if the demo‐ tion process was unsuccessful or you are unable to bring a domain controller back online after a hardware or software failure. Solution Use the following steps to remove ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
97
snap-in when Advanced Features has been selected from the View menu (so the System container will be displayed), or with the AdMod tool. 4. Delete the server object associated with the failed domain controller in the Active Directory Sites and Services MMC. Discussion If the domain controller that you are forcibly remo...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
98
3.11. Renaming a Domain Controller Problem You want to rename a domain controller. Solution Your first step in renaming a domain controller is as follows, where <NewName> is a fully qualified domain name (FQDN): > netdom computername <CurrentName> /Add:<NewName> The new name will be automatically replicated throughout ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
99
3.12. Finding the Domain Controllers for a Domain Problem You want to find the domain controllers in a domain. Solution Using a graphical user interface 1. Open the Active Directory Users and Computers snap-in (dsa.msc). 2. Right-click on the target domain and select Find. 3. In the Find drop-down box, select Computers...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
100
3.13. Finding the Closest Domain Controller Problem You want to find the closest domain controller for a particular domain. Solution Using a command-line interface The following command finds the closest domain controller in the specified domain (<DomainDNSName>); that is, a domain controller that is located in the sam...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
101
Using PowerShell Similar to nltest, you can specify additional criteria for finding a domain controller by using the -Filter parameter. The following are some of the most used filters: IsGlobalCatalog IsReadOnly Site Service 3.14. Finding a Domain Controller’s Site Problem You need to determine the site of which a doma...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
102
See Also Recipe 3.13 3.15. Moving a Domain Controller to a Different Site Problem You want to move a domain controller to a different site. Solution Using a graphical user interface 1. Open the Active Directory Sites and Services snap-in (dssite.msc). 2. In the left pane, expand the site that contains the domain contro...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
103
Discussion When you install a new domain controller, a server object and nTDSDSA object for the domain controller get added to the site topology. The Knowledge Consistency Checker (KCC) and Intersite Topology Generator (ISTG) use these objects to determine whom the domain controller should replicate with. A domain cont...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
104
See Also Recipe 3.14 for finding a domain controller’s site; Recipe 4.20 for moving objects to different containers 3.16. Finding the Services a Domain Controller Is Advertising Problem You want to find the services that a domain controller is advertising. Solution The following command will display the list of service...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
105
In the previous example, GTIMESERV denotes a DC that is a master time server. WRITABLE denotes a DC that holds a writable copy of the Active Directory database. Prior to Windows Server 2008, only NT 4.0 BDCs would not possess this flag. Since 2008, Read-Only Domain Controllers will also lack the WRITABLE flag. Discussi...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
106
1. Launch the Active Directory Administrative Center. 2. In the left pane, select the domain and then double-click the Deleted Objects container in the right pane. 3. In the Filter box near the top of the Active Directory Administrative Center, enter the domain controller name to narrow down the displayed objects to th...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
107
collisions. In a case where you want to restore an object that has been inadvertently deleted, you need to perform an authoritative restore to prevent the deletion from re‐ propagating to the restored domain controller. You can mark an entire restore as au‐ thoritative, or any subtree of your AD environment down to a s...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
108
Use this command with care, though, as resetting Winsock can cause network applica‐ tions such as antivirus scanners to malfunction and require reinstallation. A reboot is required to complete the Winsock reset. See Also MS KB 299357 (How to reset Internet Protocol (TCP/IP)) 3.19. Configuring a Domain Controller to Use...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
109
<Peers> in the preceding code refers to a space-separated list of FQDNs of external time servers. Each DNS name must be followed by ,0x1 for the rest of these settings to take effect. Once you have made these changes to the Registry, stop and restart the W32time service by issuing the following commands: > net stop w32...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
110
To configure the PDC Emulator to use its own internal clock as a time source instead of relying on an external clock, modify the HKLM\SYSTEM \CurrentControlSet\Services\W32Time\Config\AnnounceFlags DWORD value to contain a value of 0x0A. The algorithm used by domain controllers to sync time gets quite complex. See the ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
111
3.21. Enabling the /3GB Switch to Increase the LSASS Cache Problem You have installed more than 1 GB of memory on your 32-bit domain controllers and want to enable the /3GB switch so that the LSASS process can use more memory. Solution Using a command-line interface On a 32-bit Windows Server 2008 server, run the follo...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
112
Solution Using a graphical user interface 1. Open the Active Directory Sites and Services snap-in (dssite.msc). 2. Browse to the nTDSDSA object (NTDS Settings) underneath the server object for the domain controller for which you want to enable or disable the global catalog. 3. Right-click on NTDS Settings and select Pr...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
113
Discussion The first domain controller promoted into a forest is also made a global catalog (GC) server by default. In a single-domain environment, the global catalog server incurs no memory or bandwidth overhead beyond that of a domain controller, so you could con‐ figure each DC in a single-domain forest as a GC with...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
114
3.23. Determining Whether Global Catalog Promotion Is Complete Problem You want to determine whether a domain controller is a global catalog server. After you initially enable the global catalog on a domain controller, it can take some time for all of the read-only naming contexts to replicate to it, depending on the n...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
115
Discussion Once a server has completed initial replication of the global catalog, the attribute is GlobalCatalogReady in the RootDSE will be set to TRUE. Another way to determine if a domain controller has been at least flagged to become a global catalog is by checking whether the options attribute on the nTDSDSA objec...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
116
is a global catalog server yet. See Recipe 3.23 for more information on how to tell whether a server marked as a global catalog is ready to accept requests as one. See Also Recipe 3.23 for determining whether global catalog promotion is complete 3.25. Finding the Domain Controllers or Global Catalog Servers in a Site P...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
117
Discussion Each domain controller has a server object within the Servers container for the site it is a member of (e.g., cn=DC1,cn=Servers,cn=MySite,cn=site,cn=configura tion,dc=adatum,dc=com). Since other types of servers can have server objects in a site’s Servers container, domain controllers are differentiated by t...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
118
Discussion One of the benefits of Active Directory over its predecessor, Windows NT, is that it relies on DNS for name resolution, which is the standard for name resolution on the Internet and on most TCP/IP-based networks. Active Directory uses DNS to locate servers that serve a particular function, such as a domain c...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
119
Discussion Each domain controller registers several SRV records that clients use as part of the DC locator process to find the closest domain controller. Two fields of the SRV record let clients determine which server to use when multiple possibilities are returned. The Priority field is used to dictate whether a speci...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
120
use unless all other domain controllers fail, or modify the Weight to reduce how often it will be used. You can modify this information manually within the DNS Management Console, or for multiple DCs using Group Policy Objects in the Computer Configuration\Admin istrative Templates\System\Net Logon\DC Locator DNS Recor...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
121
2. Right-click on Active Directory Domains and Trusts in the left pane and select Operations Master. For the PDC Emulator, RID Master, and Infrastructure Master: 1. Open the Active Directory Users and Computers snap-in (dsa.msc). 2. Make sure you’ve targeted the correct domain. 3. Right-click on Active Directory Users ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
122
oleOwner attribute on various objects in Active Directory depending on the role. Table 3-5 contains a list of FSMO roles. Table 3-5. FSMO roles Role Description fSMORoleOwner location Domain- or forest-wide? Schema Processes schema updates. cn=Schema,cn=Configura tion,<ForestDN> Forest Domain Naming Processes the addit...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
123
Solution Using a graphical user interface 1. Use the same directions as described in Recipe 3.29 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. 2. Click the Change button. 3...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
124
If a FSMO role owner becomes unavailable before you can transfer it, you’ll need to seize the role (see Recipe 3.31). Using a command-line interface Any role can be transferred using ntdsutil by replacing "transfer PDC" in the solution with one of the following: • "transfer domain naming master" • "transfer infrastruct...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
125
• "seize domain naming master" • "seize infrastructure master" • "seize RID master" • "seize schema master" Using PowerShell The following will seize the PDC Emulator role to <NewRoleOwner>: > Move-ADDirectoryServerOperationMasterRole <NewRoleOwner> -PDCEmulator -Force Discussion Seizing a FSMO role should not be taken...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
126
Discussion The PDC Emulator FSMO role is the only FSMO role that is stored in DNS. Like many of the other Active Directory−related DNS records, the PDC record is stored as an SRV record under _ldap._tcp.pdc._msdcs.<DomainDNSName> where <DomainDNSName> is the domain the PDC is in. This allows your Active Directory clien...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
127
null
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
128
CHAPTER 4 Searching and Manipulating Objects 4.0. Introduction Active Directory is based on Lightweight Directory Access Protocol (LDAP) and sup‐ ports the LDAP version 3 specification defined in RFC 2251. And while many of the AD tools and interfaces, such as ADSI, abstract and streamline LDAP operations to make thing...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
129
Table 4-1. Common attributes of objects Attribute Description cn RDN attribute for most object classes, also referred to as the common name. whenCreated Timestamp when the object was created. See Recipe 4.26 for more information. description Multivalued attribute that can be used as a generic field for storing a descri...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
130
6. The contents of the RootDSE will be shown in the right pane. Using a command-line interface To display the RootDSE of a domain controller using AdFind, use the following syntax: > adfind -rootdse Using PowerShell Get-ADRootDSE You’ll see results similar to the following (truncated for readability): configurationNami...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
131
Discussion The RootDSE was originally defined in RFC 2251 as part of the LDAPv3 specification. It is not part of the Active Directory namespace per se. It is a synthetic object that is maintained separately by each domain controller. The RootDSE can be accessed anonymously using LDP; the command-line and Pow‐ erShell s...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
132
8. Click OK. 9. From the menu, select View→Tree. 10. For BaseDN, type the DN of the object you want to view. 11. For Scope, select Base. 12. Click OK. Using a command-line interface To obtain a list of attributes for a particular object using DSQuery, use the following syntax: > dsquery * "<ObjectDN>" -scope base -attr...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
133
Description : Built-in account for administering the computer/domain DisplayName : DistinguishedName : cn=Administrator,cn=Users,dc=adatum,dc=com Division : DoesNotRequirePreAuth : False dSCorePropagationData : {9/27/2012 11:34:42 AM,↵ 9/27/2012 11:34:42 AM,↵ 9/27/2012 11:19:31 AM,↵ 1/1/1601 10:12:16 AM} EmailAddre...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
134
ObjectCategory : cn=Person,cn=Schema,cn=Configuration,↵ dc=adatum,dc=com ObjectClass : user ObjectGUID : c897bc0a-b5d4-4025-8c10-b696e45ce780 objectSid : S-1-5-21-3384837461-4027165227-↵ 453512602-500 Office : OfficePhone : Organization : OtherName : PasswordExpired : False PasswordLastSet : 9/27/2012 10:18:17 AM Pa...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
135
Using a graphical user interface You can customize the list of attributes returned from a search with LDP by modifying the Attributes: field under Options→Search. To include all attributes, enter an asterisk (*). To modify the default subset of attributes that are returned, enter a semicolon-separated list of attribute...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
136
6. From the menu, select Connection→Bind. 7. Accept the default and bind as the currently logged on user or select the option to bind with credentials and then enter the credentials. 8. Click OK. 9. From the menu, select Browse→Search. 10. Enter the base DN, scope, and LDAP filter of the objects that you’re looking for...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
137
Discussion Using PowerShell The PowerShell commands can target a specific container or OU, as follows: Get-ADObject -SearchBase "OU=Branches,dc=adatum,dc=com"↵ -Filter {(objectClass -eq "user") -and (objectCategory -eq "person")} |↵ Measure-Object | FL Count Be careful with the filtering. The class and category of th...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
138
Using a command-line interface The AdFind and AdMod utilities will enable a number of LDAP controls, either by default or through the use of various command-line switches. For example, the –show del switch will invoke the Show Deleted Objects LDAP control, and -stats will invoke the Show Stats control. Using PowerShell...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
139
Name OID Description No referrals generated 1.2.840.113556.1.4.1339 Informs the server not to generate any referrals in a search response. Domain or phantom scope 1.2.840.113556.1.4.1340 Used to pass flags to the server to control search options. Search Stats 1.2.840.113556.1.4.970 Used to return statistics about an LD...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
140
Solution Using a graphical user interface 1. Open LDP. 2. From the menu, select Connection→Connect. 3. For Server, enter the name of a DC. 4. For Port, enter 389. 5. Click OK. 6. From the menu, select Options→Connection Options. 7. Under Option Name:, select LDAP_OPT_FAST_CONCURRENT_BIND. 8. Click the Set button. Then ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
141
available. For example, if you bind to a user object using an ADSI fast bind, then only the basic IADs interfaces will be available, not the IADsUser interfaces. This is the complete list of interfaces that are available for objects retrieved with fast binds: • IADs • IADsContainer • IDirectoryObject • IDirectorySearch...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
142
2. From the menu, select Connection→Connect. 3. For Server, enter the name of a domain controller (or leave it blank to do a serverless bind). 4. For Port, enter 389. 5. Click OK. 6. From the menu, select Connection→Bind. 7. Accept the default and bind as the currently logged on user or select the option to bind with c...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
143
Solution Using a graphical user interface 1. Open LDP. 2. From the menu, select Connection→Connect. 3. For Server, enter the name of a domain controller (or leave it blank to do a serverless bind). 4. For Port, enter 389. 5. Click OK. 6. From the menu, select Connection→Bind. 7. Accept the default and bind as the curre...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
144
Using PowerShell Get-ADObject (Get-ADRootDSE).DefaultNamingContext -Properties wellKnownObjects↵ | Select wellKnownObjects -ExpandProperty wellknownobjects Discussion The Domain NC in Active Directory contains a number of well-known GUIDs that correspond to containers that exist in every AD implementation. These GUIDs...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
145
4.8. Searching for Objects in a Domain Problem You want to find objects in a domain that match certain criteria. Solution Using a graphical user interface 1. Open LDP. 2. From the menu, select Connection→Connect. 3. For Server, enter the name of a domain controller (or leave it blank to do a serverless bind). 4. For Po...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
146
Querying for SAM account names of user objects with adfind takes the following syntax: > adfind -b dc=adatum,dc=com -f↵ "(&(objectclass=user)(objectcategory=person))" sAMAccountName Both DSQuery and AdFind assume a default search scope of subtrees; you need only to specify the search scope if you want to use a differe...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
147
Using a command-line interface <AttrList> should be a space-separated list of attributes to return. To return all at‐ tributes that have been populated with a value, leave this field blank or use an asterisk (*). See Also Recipe 4.2 for viewing attributes of objects; Recipe 4.9 for setting advanced ADO op‐ tions; RFC 2...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
148
Using a command-line interface To query the global catalog using DSQuery, use the following syntax: > dsquery * <BaseDN> -gc -scope <Scope> -filter "<Filter>" -attr "<AttrList>" To run a query using AdFind, use the following syntax: > adfind -gc -b <BaseDN> -s <Scope> -f <Filter> <Attributes> Using PowerShell To query ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
149
Using a command-line interface The only difference between this solution and the one in Recipe 4.8, both for DSQuery and AdFind, is the addition of the -gc flag. See Also Recipe 4.8 for searching for objects; Recipe 10.13 4.10. Searching for a Large Number of Objects Problem Your search is returning exactly 1,000 objec...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
150
12. For Filter, enter an LDAP filter. 13. Click Options to customize the options for this query. 14. For “Time limit,” enter a value such as 120. 15. For “Size limit,” enter the number of objects to be returned with each page (e.g., 1,000). 16. Under Search Call Type, select Paged. 17. Click OK and then Run to perform ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
151
Note that newer tools aren’t as limited as some of the tools that have been around a long time. For example, the Active Directory Administrative Center displays up to 20,000 objects in a search by default. Using a command-line interface The only difference between this solution and the one in Recipe 4.8 is the addition...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
152
8. For Scope, select Base. 9. For Filter, enter an LDAP filter to match against the objects that are part of the multivalued DN attribute. 10. Click Run. Attribute-scoped queries can only be performed using a Base scope. Using a command-line interface AdFind allows attribute-scoped queries by using the -asq switch. For...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
153
Filter The filter will match against objects defined in the Control Value. For example, a filter of (objectClass=computer) would match computer objects only. You can also use any other attributes that are available with those objects. The following filter would match all computer objects that have a Description attribu...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
154
9. From the menu, select Browse→Search. 10. For Base DN, type the base distinguished name of where the search will start. (You can leave this blank if you wish to connect to the domain NC as the base DN.) 11. For Scope, select the appropriate scope. 12. For the Filter, enter the bitwise expression, such as the followin...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
155
The userAccountControl attribute on user and computer objects is used to describe a whole series of properties, including account status (i.e., enabled or disabled), account lockout, password not required, smartcard authentication required, and so on. The searchFlags and systemFlags attributes on attributeSchema object...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
156
Just as before, this will match userAccountControl attributes that contain either the 2 or 512 flag; we’re performing two OR operations against the same value, first ORing the value against 2, then against 512. For the logical AND operator, similar principles apply. Instead of any of the bits in the flag being a possib...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
157
Solution In each solution in this recipe, an example of adding a user object is shown. Modify the examples as needed to include whatever class and attributes you need to create. Using a graphical user interface 1. Open ADSI Edit. 2. If an entry for the naming context you want to browse is not already displayed, do the ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
158
Using PowerShell To create a new computer object named Kiosk2 in the Workstations OU, use the fol‐ lowing PowerShell command: New-ADObject -Path "OU=Workstations,dc=adatum,dc=com" -Type Computer ↵ -Name "Kiosk2" -Description "Computer in lobby" -OtherAttributes ↵ @{SamAccountName="Kiosk2"} Discussion To create an objec...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
159
4.14. Modifying an Object Problem You want to modify one or more attributes of an object. Solution The following example sets the employeeID attribute for a user object. Using a graphical user interface 1. Open Active Directory Administrative Center. 2. In the bottom-right pane, enter the search criteria of the desired...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
160
Using PowerShell To modify an object using PowerShell, use the following syntax: Set-ADObject -Identity <"ObjectDN"> -Replace @{<property>=<"value">} Discussion Using a command-line interface For more on ldifde, see Recipe 4.28. As of the publication of this book, the only types of objects you can modify with DSMod are...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
161
4.15. Modifying a Bit-Flag Attribute Problem You want to safely modify an attribute that contains a bit flag, without blindly over‐ writing its existing contents. The solutions in this recipe modify a new attribute named adatum-UserProperties that was previously added to the schema. Solution Using VBScript ' This code ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
162
Using PowerShell To set the adatum-UserProperties value using PowerShell, use the following example script: $user = Get-ADObject "cn=jsmith,cn=users,dc=adatum,dc=com"↵ -Properties adatum-UserProperties if (!$user.adatum-UserProperties) { Set-ADObject $user -Add @{"adatum-UserProperties"=4} Write-Host "Changed from NUL...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
163
You will, however, find that searching for information based on a bit￾flag attribute is not terribly efficient. This is because bit flags cannot be indexed; you need to calculate the value for every object populated with the bit-flag attribute in question. They later find out that jsmith was a former basketball player ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
164
4.16. Dynamically Linking an Auxiliary Class Problem You want to dynamically link an auxiliary class to an existing object instance. Solution In each solution in this recipe, an example of adding the custom adatum-SalesUser auxiliary class to the jsmith user object will be described. Using a graphical user interface 1....
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
165
Using PowerShell Set-ADObject -Identity "cn=jsmith,cn=users,dc=adatum,dc=com"↵ -Add @{ObjectClass="adatum-SalesUser"} Discussion Dynamically linking an auxiliary class to an object is an easy way to use new attributes without modifying the existing object class definition in the schema. A situation in which it makes m...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
166
6. Click Browse→Add Child. The Add window will appear. 7. In the DN text box, enter the DN of the new object. 8. In the Attribute text box, enter objectClass. In the Values text box, enter the object class of the object you are creating, such as 'user'. Click Enter. In the Values text box, type dynamicObject and click ...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
167
• Dynamic objects that are containers cannot have static child objects. • A dynamic container will not expire prior to any child objects contained within it. If the dynamic container has a lower TTL value than any of the children, once the container’s TTL expires it will be reset to the highest TTL value of the childre...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
168
12. For Values, enter the new time to live (TTL) for the object in seconds. 13. Under Operation, select Replace. 14. Click Enter. 15. Click Run. Using a command-line interface Create an LDIF file called refresh_dynamic_object.ldf with the following contents: dn: cn=jsmith,cn=users,dc=adatum,dc=com changetype: modify re...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
169
4.19. Modifying the Default TTL Settings for Dynamic Objects Problem You want to modify the minimum and default TTLs for dynamic objects. Solution In each solution in this recipe, we’ll show how to set the DynamicObjectDefaultTTL setting to 172800. Modifying the DynamicObjectMinTTL can be done in the same manner. Using...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
170
"commit changes" "show values" q q Discussion Two configuration settings apply to dynamic objects: dynamicObjectDefaultTTL Defines the default TTL that is set for a dynamic object at creation time unless another one is set via entryTTL dynamicObjectMinTTL Defines the smallest TTL that can be configured for a dynamic ob...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
171
2. In the bottom-right pane, enter the search criteria of the desired object and then click the Search button. 3. In the search results, locate the object, right-click it, and then click Move. 4. In the dialog box, browse to the destination container, click to highlight it, and then click OK to move the object. You can...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
172
See Also Recipe 4.23; MSDN: IADsContainer::MoveHere 4.21. Moving an Object to a Different Domain Problem You want to move an object to a different domain. Solution Using a graphical user interface (ADMT 3.2) To migrate a computer object between domains in the same forest, use the following steps: 1. Open the ADMT MMC s...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
173
• User rights 9. On the Computer Options screen, click Next to maintain the default reboot time of 5 minutes. 10. On the Object Property Exclusion screen, select any object properties that you do not want to migrate and then click Next. 11. On the Conflict Management screen, click Next to accept the default that will n...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
174
Container::MoveHere; “ADMT Guide: Migrating and Restructuring Active Directory Domains” 4.22. Referencing an External Domain Problem You need to create a reference to an external Active Directory domain. Solution Using a graphical user interface 1. Open ADSI Edit. 2. If an entry for the naming context you want to brows...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
175
Then run the following command: > ldifde -v -i -f create_crossref.ldf You can also create a crossRef using AdMod as follows: > admod -config -rb cn=othercorp.com,cn=partitions↵ objectClass::crossRef cn::othercorp.com nCName::dc=othercorp,dc=com↵ dnsRoot::dc1.othercorp.com -add Discussion Similar to the way in which DNS...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
176
Solution Using a graphical user interface 1. Open ADSI Edit. 2. If an entry for the naming context you want to browse is not already displayed, do the following: a. Right-click on ADSI Edit in the right pane and click “Connect to.” b. Fill in the information for the naming context, container, or OU that contains the ob...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
177
Using PowerShell To rename an object using PowerShell, use the following syntax: Rename-ADObject -Identity "<Object DN>" -NewName "<New Value of 'name' attribute>" Discussion Before you rename an object, you should ensure that no applications reference it by name. You can make objects rename-safe by requiring all appli...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
178
4.24. Deleting an Object Problem You want to delete an individual object. Solution Using a graphical user interface 1. Open ADSI Edit. 2. If an entry for the naming context you want to browse is not already displayed, do the following: a. Right-click on ADSI Edit in the right pane and click “Connect to.” b. Fill in the...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
179
Using a command-line interface You can delete an object using the built-in dsrm utility, as well as AdMod. For dsrm, use the following syntax: > dsrm "<ObjectDN>" For AdMod, enter the following: > admod -b "<ObjectDN>" -del Using PowerShell To delete the “Branches” OU in the adatum.com domain, use the following command...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
180
4.25. Deleting a Container That Has Child Objects Problem You want to delete a container or organizational unit and all child objects contained within. Solution Using a graphical user interface Open ADSI Edit and follow the same steps as in Recipe 4.24. The only difference is that you’ll be prompted to confirm twice in...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
181
As with the other operations we’ve discussed in this chapter (create, rename, move, and so on), the user performing the delete operation needs to have the necessary permissions to delete the object or objects in question. Active Directory permissions are discussed more extensively in Chapter 14. See Also Recipe 4.24 fo...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
182
Discussion When an object is created or modified in Active Directory, the createTimestamp and modifyTimestamp attributes get set with the current time. The createTimestamp at‐ tribute is replicated between domain controllers, so assuming the latest modification of the object in question has replicated to all domain con...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
183
To change the MaxPageSize value to 2,000, you can do the following: > ntdsutil "ldap pol" conn "con to server <DomainControllerName>" q ldap policy: set MaxPageSize to 2000 ldap policy: Commit Changes Discussion The LDAP query policy contains several settings that control how domain controllers handle searches. By defa...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
184
policy to. This can be done via the Active Directory Sites and Services snap-in by browsing to the nTDSDSA object of a domain controller (cn=NTDS Settings), right-clicking on it, and selecting Properties. You can then select the new policy from a drop-down menu beside Query Policy. Click OK to apply the new policy. You...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
185
is the search filter, and -d is the base DN. If you encounter any problems using ldifde, the -v switch enables verbose mode and can help identify problems. See Also Recipe 4.29 for importing objects using LDIF; RFC 2849 (The LDAP Data Interchange Format [LDIF]—Technical Specification); MS KB 237677 (Using LDIFDE to Imp...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
186
See Also Recipe 4.28 for information on LDIF; RFC 2849 (The LDAP Data Interchange Format [LDIF]—Technical Specification); MS KB 237677 (Using LDIFDE to Import and Export Directory Objects to Active Directory) 4.30. Exporting Objects to a CSV File Problem You want to export objects to a comma-separated values (CSV) file...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
187
Discussion Once you have a CSV file containing entries, you can use a spreadsheet application such as Excel to view, sort, and manipulate the data. Using a graphical user interface Before performing the export, add any needed columns to the view in Active Directory Users and Computers. To add columns, click on View and...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
188
Solution Using PowerShell You must first create a CSV file containing the objects to add. The first line of the file should contain a comma-separated list of attributes you want to set, with DN being the first attribute. Here is an example: DN,objectClass,cn,sn,userAccountControl,sAMAccountName,userPrincipalName The re...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
189
null
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
190
CHAPTER 5 Organizational Units 5.0. Introduction An LDAP directory such as Active Directory stores data in a hierarchy of containers and leaf nodes called the directory information tree (DIT). Leaf nodes are end points in the tree, while containers can store other containers and leaf nodes. In Active Directory, the two...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
191
Attribute Description msDS-Approx-Immed-Subordinates Approximate number of direct child objects in the OU. See Recipe 5.11 for more information. managedBy DN of user or group that is in charge of managing the OU. ou Relative distinguished name of the OU. modifyTimestamp Timestamp of when the OU was last modified. creat...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
192
> DN Count: 1 > Using server: dc1.adatum.com > Adding specified objects... > DN: ou=Finance,dc=adatum,dc=com... > > The command completed successfully Using PowerShell To create an organizational unit named “Finance,” create a description of “Finance OU,” and not protect the OU from accidental deletion, use the followi...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
193
5.2. Enumerating the OUs in a Domain Problem You want to enumerate all containers and OUs in a domain, which effectively displays the structure of the domain. Solution Using a graphical user interface 1. Open the Active Directory Users and Computers snap-in (dsa.msc). 2. If you need to change domains, right-click on Ac...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
194
Using PowerShell To enumerate all OUs in the current domain using PowerShell, run the following command: Get-ADOrganizationalUnit -Filter * | Select DistinguishedName Discussion Using a graphical user interface If you want to expand all containers and OUs within an OU, you have to manually expand each one within ADUC o...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf
195
Using a command-line interface > adfind -f "ou=<OU Name>" Using PowerShell To find any OU with “Test” in the name under the EMEA OU, run the following command: Get-ADOrganizationalUnit -SearchBase "ou=emea,dc=adatum,dc=com"↵ -LDAPFilter {(ObjectCategory=OrganizationalUnit)} |↵ Where {$_.Name -Match "Test"} The comman...
http://ter40.free.fr/ebooktmp/new/Active%20Directory%20Cookbook,%204th%20Edition.pdf