Book Image

Active Directory with PowerShell

By : Pamarthi Venkata Sitaram, YELLAPRAGADA U PADMAVATHI
5 (1)
Book Image

Active Directory with PowerShell

5 (1)
By: Pamarthi Venkata Sitaram, YELLAPRAGADA U PADMAVATHI

Overview of this book

Table of Contents (16 chapters)
Active Directory with PowerShell
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing sites and subnets


Sites and subnets play a critical role in controlling authentication traffic and replication traffic in the Active Directory environment. In the same way we managed several logical components of Active Directory, these physical components also can be managed. However, there are no cmdlets available directly in Active Directory module to create and modify sites and subnets such as New-ADSite, Set-ADSite, and so on. We need to write a piece of code to query these objects using the Get-ADObject cmdlet and modify using the Set-ADObject cmdlet.

Querying sites and subnets

Sites and subnets are part of Configuration Naming Context (CNC) in Active Directory. By default, the Active Directory cmdlets query the domain naming context where the data of users, computers, groups, and OUs is stored. So, we need to tell the cmdlets to look at CNC to query sites and subnets.

First, we need to get the DN of the CNC partition, so that we can make use of it further in our code, as follows...