Building the Admin Area (Tier0) is a challenge on its own. This area is not only the OU subtree, but many other containers, which will have the “accessing” groups stored here.
There are several steps to build this tier:
- Organizational Units
- Move objects
- Default Administrators Accounts
- Creating Groups
- Fine Grained Password Policy
- Group Nesting
- Modify AdminSdHolder
- Default Container Redirection
- Initial setup of Servers Area (Tier1)
- Initial setup of Sites Area (Tier2)
- Start with Delegations
Organizational Units needed to build Admin Area (Tier0)
We will start with the “Admin” Organizational Unit. When creating an OU, this one does have inherit permissions from the parent, which might become a issue when dealing with high privileged accounts. For example, if there is a rouge delegation at the domain level, which can reset AD User password, this one will be applied to this new Admin OU, which is a security risk.
We start by creating our OU:
[pastacode manual=”%3Ccode%3E%23%20Create%20OU%0A%20%20%20%20%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Name%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’ouName’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Path%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’ouPath’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20City%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’ouCity’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Country%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’ouCountry’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Description%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’ouDescription’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20DisplayName%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’strOuDisplayName’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20PostalCode%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’ouZIPCode’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20ProtectedFromAccidentalDeletion%20%3D%20%24true%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20StreetAddress%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’ouStreetAddress’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20State%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’ouState’%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%24OUexists%20%3D%20New-ADOrganizationalUnit%20%40parameters%0A%3C%2Fcode%3E” provider=”manual” lang=”php”/]This will create the OU, with all pre-defined ACL’s (including Orphan SIDs) and inheritance. And as we already mention, is not what we want. So now that we have this OU, we have to block inheritance, copy ACLs and “Clan it up”; this is done by removing inheritance, and copying the inherited ACLs; then we do remove all of those ACEs that we do not need, as is the case of “Pre-Windows 2000”, “Account Operators” and “Print Operators”. We also be removing any orphan SID (this SID on the ACE which cannot be resolved to a name, most likely because the object was deleted) and any other delegation that might interfere with the setup we are doing here. We will end up with something similar to this:

In order to automate the build of Admin Area (Tier0), EguibarIT PowerShell Module provides some CMDlets that can help:
New-DelegateAdOU
[pastacode manual=”%3Ccode%3ENew-DelegateAdOU%20-%3F%0A%0ANAME%0A%20%20%20%20New-DelegateAdOU%0A%0ASYNOPSIS%0A%20%20%20%20Create%20New%20custom%20delegated%20AD%20OU%0A%0A%0ASYNTAX%0A%20%20%20%20New-DelegateAdOU%20%26%2391%3B-ouName%5D%20%3CString%3E%20%26%2391%3B-ouPath%5D%20%3CString%3E%20%26%2391%3B%26%2391%3B-ouDescription%5D%20%3CString%3E%5D%20%26%2391%3B%26%2391%3B-ouCity%5D%20%3CString%3E%5D%20%26%2391%3B%26%2391%3B-ouCountry%5D%20%3CString%3E%5D%20%26%2391%3B%26%2391%3B-ouStreetAddress%5D%0A%20%20%20%20%3CString%3E%5D%20%26%2391%3B%26%2391%3B-ouState%5D%20%3CString%3E%5D%20%26%2391%3B%26%2391%3B-ouZIPCode%5D%20%3CString%3E%5D%20%26%2391%3B%26%2391%3B-strOuDisplayName%5D%20%3CString%3E%5D%20%26%2391%3B%26%2391%3B-RemoveAuthenticatedUsers%5D%5D%20%26%2391%3B%26%2391%3B-CleanACL%5D%5D%20%26%2391%3B-WhatIf%5D%20%26%2391%3B-Confirm%5D%0A%20%20%20%20%26%2391%3B%3CCommonParameters%3E%5D%0A%0A%0ADESCRIPTION%0A%20%20%20%20Create%20New%20custom%20delegated%20AD%20OU%2C%20and%20remove%0A%20%20%20%20some%20groups%20as%20Account%20Operators%20and%20Print%20Operators%3C%2Fcode%3E” provider=”manual” lang=”php”/]This is a wrapper functions that 1) Checks for OU existence, and create it if doe not exist 2) Calls “Start-AdCleanOU” to remove unwanted ACEs 3) Call “Remove-SpecificACLandEnableInheritance” to manage inheritance and specific ACEs
Start-AdCleanOU
[pastacode manual=”%3Ccode%3EStart-AdCleanOU%20-%3F%0A%0ANAME%0A%20%20%20%20Start-AdCleanOU%0A%0ASYNOPSIS%0A%20%20%20%20Clean%20default%20OU%20permissions.%0A%0A%0ASYNTAX%0A%20%20%20%20Start-AdCleanOU%20%26%2391%3B-LDAPpath%5D%20%3CString%3E%20%26%2391%3B%26%2391%3B-RemoveAuthenticatedUsers%5D%5D%20%26%2391%3B%26%2391%3B-RemoveUnknownSIDs%5D%5D%20%26%2391%3B%3CCommonParameters%3E%5D%0A%0A%0ADESCRIPTION%0A%20%20%20%20The%20function%20will%20remove%20some%20of%20the%20default%20premission%20on%0A%20%20%20%20the%20provided%20OU.%20It%20will%20remove%20the%20%22Account%20Operators%22%20and%0A%20%20%20%20%22Print%20Operators%22%20built-in%20groups.%3C%2Fcode%3E” provider=”manual” lang=”php”/]This is another wrapper function that provides functionality to clean any other OU. It relies on EguibarIT.Delegation PowerShell Module CMDlets.
Creating the sub-OU structure
The following step is to create remaining OUs. By using these functions, we can optimize the creation of ANY OU that we might need, and as described before, building the Admin Area (Tier0). So the following sub-OU have to be created (but not limited to…):
Sub-OU | Objects | Justification |
Users | User Identities | Any user object which has administrative rights within the domain. The rights can be inherited, as the Administrator account, by group membership of privileged groups as Domain Admins or Account operators, or any other group used to delegate rights. This OU will have its own set of configurations for the users (GPO) and it will have a Fine Grained Password Policy. |
Groups | Global/Universal Groups | This container will differentiate the organizational groups from the ones belonging to the Rights OU. These groups (as per definition) should only contain as members, users and other groups, and shall not be granted any right. Only Privileged, Semi-Privileged and Service Accounts can belong to these kinds of groups. This OU will have its own set of configurations for the computers (GPO). |
Housekeeping | Users & Computers | Staled user objects and computer objects. An automated procedure will search for staled objects and move those to this container in order to delete when thresholds are met. |
Infrastructure Services | Computers | Any server belonging to Tier0 and providing services exclusively to this area/tier. This could be the virtualization servers, patching servers, deployment servers, monitoring servers, etc. |
Privileged Groups | Global/Universal Groups | Delegation model Privileged groups. |
Privileged Access Workstations | Computers | Highly secured computers (known as PAW) used to administer the domain. RDP to manage Domain Controllers is not a desired practice, and doing so from a “standard” PC must be avoided by any means. Instead these designated management computers will fulfill this request. |
PAW Tier0 | Computers | Privileged Access Workstation restricted exclusively for Administration Area / Tier0 |
PAW Tier1 | Computers | Privileged Access Workstation restricted exclusively for Servers Area / Tier1 |
PAW Tier2 | Computers | Privileged Access Workstation restricted exclusively for Sites Area / Tier2 |
Rights | Domain Local Groups | Any ACL granting access within the domain has to be assigned to these groups. This container will only have groups which are delegated rights. Although this container could be merged with the Groups one, is a good idea to have clearly identified the standard groups (As the ones in the groups container, which its SACLs are not modified nor assigned to any other system object) from the groups which DO have additional access rights. |
Service Accounts | User/Service Identities | By design, a service account should be guarded and kept extremely secured. Whenever possible, a ServiceAccount object should be created instead. If a ServiceAccount object cannot be created, additional security measures should be implemented. This OU will have its own set of configurations for the users (GPO) and it will have a Fine Grained Password Policy. |
Service-Accounts Tier 0 | User/Service Identities | Service Accounts and/or Managed Service Accounts used exclusively for Administration Area / Tier0 |
Service-Accounts Tier 1 | User/Service Identities | Service Accounts and/or Managed Service Accounts used exclusively for Servers Area / Tier1 |
Service-Accounts Tier 2 | User/Service Identities | Service Accounts and/or Managed Service Accounts used exclusively for Sites Area / Tier2 |
We will end up having something similar to this:

Move objects to newly created Admin Area (Tier0)
After our “brand new” container was created, and that is secured, is time to move objects into it. There are many objects that cannot be moved (we are talking about many built-in domain local groups), but for those which can be moved.
[pastacode manual=”%3Ccode%3EGet-ADUser%20-Identity%20%24AdminName%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItAdminAccountsOuDn%0AGet-ADUser%20-Identity%20%24confXML.n.Admin.users.Guest.Name%20%7C%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItAdminAccountsOuDn%0AGet-ADUser%20-Identity%20krbtgt%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItAdminAccountsOuDn%0A%0AGet-ADGroup%20-Identity%20’Domain%20Admins’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Identity%20’Enterprise%20Admins’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Identity%20’Schema%20Admins’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Identity%20’Domain%20Controllers’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Identity%20’Group%20Policy%20Creator%20Owners’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Identity%20’Read-only%20Domain%20Controllers’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Identity%20’Enterprise%20Read-only%20Domain%20Controllers’%20%7C%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0A%0AGet-ADGroup%20-Identity%20’DnsUpdateProxy’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItAdminGroupsOuDn%0AGet-ADGroup%20-Identity%20’Domain%20Users’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItAdminGroupsOuDn%0AGet-ADGroup%20-Identity%20’Domain%20Computers’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItAdminGroupsOuDn%0AGet-ADGroup%20-Identity%20’Domain%20Guests’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItAdminGroupsOuDn%0A%0AGet-ADGroup%20-Identity%20’Allowed%20RODC%20Password%20Replication%20Group’%20%7C%20Move-ADObject%20-TargetPath%20%24ItRightsOuDn%0AGet-ADGroup%20-Identity%20’RAS%20and%20IAS%20Servers’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItRightsOuDn%0AGet-ADGroup%20-Identity%20’DNSAdmins’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItRightsOuDn%0AGet-ADGroup%20-Identity%20’Cert%20Publishers’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItRightsOuDn%0AGet-ADGroup%20-Identity%20’Denied%20RODC%20Password%20Replication%20Group’%20%7C%20%20Move-ADObject%20-TargetPath%20%24ItRightsOuDn%0A%0A%23%20Following%20groups%20only%20exist%20on%20Win%202012%0AGet-ADGroup%20-Identity%20’Protected%20Users’%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Identity%20’Cloneable%20Domain%20Controllers’%20%7C%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Identity%20’Access-Denied%20Assistance%20Users’%20%7C%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Filter%20%7B%20SamAccountName%20-like%20%22WinRMRemoteWMIUsers*%22%20%7D%20%7C%20%20%20%20%20%20%20%20%20%20%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0A%0A%23%20Following%20groups%20only%20exist%20on%20Win%202019%0AGet-ADGroup%20-Identity%20’Enterprise%20Key%20Admins’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7C%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%0AGet-ADGroup%20-Identity%20’Key%20Admins’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7C%20Move-ADObject%20-TargetPath%20%24ItPrivGroupsOUDn%3C%2Fcode%3E” provider=”manual” lang=”php”/]We need to have all important objects (Privileged and Semi-Privileged) under our control, thus the reason to have Admin Area.
Default Administrators Accounts
Although an Administrator default account can be tracked down by its well-known sid (SID ending with 500) is a good idea to rename it, and possibly disable it. I know there are many different discussions with regards of this, some of them in favor, and some of those against ir… but we are not going to enter this discussion here. Additionally, we will create a new Administrator Like account, which will have a normal SID instead. After initial setup, the well-known Administrator account should not be used; instead the Admin-Like account will be used. Both accounts should be heavily monitored, and of course, jealously guarded.
[pastacode manual=”%3Ccode%3E%23%20Try%20to%20get%20the%20new%20Admin%0A%24NewAdminExists%20%3D%20Get-AdUser%20-Filter%20%7B%20SamAccountName%20-eq%20%24newAdminName%20%7D%0A%0A%20%23%20Check%20if%20the%20new%20Admin%20account%20already%20exist.%20If%20not%2C%20then%20create%20it.%0A%20%20%20%20%20%20%20%20If(%24NewAdminExists)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%23The%20user%20was%20found.%20Proceed%20to%20modify%20it%20accordingly.%0A%20%20%20%20%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Enabled%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24true%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20UserPrincipalName%20%20%20%20%20%3D%20(‘%7B0%7D%40%7B1%7D’%20-f%20%24newAdminName%2C%20%24env%3AUSERDNSDOMAIN)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20SamAccountName%20%20%20%20%20%20%20%20%3D%20%24newAdminName%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20DisplayName%20%20%20%20%20%20%20%20%20%20%20%3D%20%24newAdminName%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Description%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.users.NEWAdmin.description%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20employeeId%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’0123456’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20TrustedForDelegation%20%20%3D%20%24false%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20AccountNotDelegated%20%20%20%3D%20%24true%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Company%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.RegisteredOrg%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Country%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’MX’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Department%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.users.NEWAdmin.department%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20State%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’Puebla’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20EmailAddress%20%20%20%20%20%20%20%20%20%20%3D%20(‘%7B0%7D%40%7B1%7D’%20-f%20%24newAdminName%2C%20%24env%3AUSERDNSDOMAIN)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Replace%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’employeeType’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.NC.AdminAccSufix0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’msNpAllowDialin’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24false%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’msDS-SupportedEncryptionTypes’%20%3D%20’24’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20Set-AdUser%20-Identity%20%24NewAdminExists%0A%20%20%20%20%20%20%20%20%7D%20%20Else%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20User%20was%20not%20Found!%20create%20new.%0A%20%20%20%20%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Path%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24ItAdminAccountsOuDn%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Name%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24newAdminName%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20AccountPassword%20%20%20%20%20%20%20%3D%20(ConvertTo-SecureString%20-String%20%24confXML.n.DefaultPassword%20-AsPlainText%20-Force)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ChangePasswordAtLogon%20%3D%20%24false%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Enabled%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24true%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20UserPrincipalName%20%20%20%20%20%3D%20(‘%7B0%7D%40%7B1%7D’%20-f%20%24newAdminName%2C%20%24env%3AUSERDNSDOMAIN)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20SamAccountName%20%20%20%20%20%20%20%20%3D%20%24newAdminName%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20DisplayName%20%20%20%20%20%20%20%20%20%20%20%3D%20%24newAdminName%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Description%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.users.NEWAdmin.description%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20employeeId%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’0123456’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20TrustedForDelegation%20%20%3D%20%24false%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20AccountNotDelegated%20%20%20%3D%20%24true%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Company%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.RegisteredOrg%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Country%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’MX’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Department%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.users.NEWAdmin.department%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20State%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’Puebla’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20EmailAddress%20%20%20%20%20%20%20%20%20%20%3D%20(‘%7B0%7D%40%7B1%7D’%20-f%20%24newAdminName%2C%20%24env%3AUSERDNSDOMAIN)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20OtherAttributes%20%20%20%20%20%20%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’employeeType’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.NC.AdminAccSufix0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’msNpAllowDialin’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24false%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’msDS-SupportedEncryptionTypes’%20%3D%20’24’%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%23%20Create%20the%20new%20Admin%20with%20special%20values%0A%20%20%20%20%20%20%20%20%20%20%20%20New-AdUser%20%40parameters%0A%20%20%20%20%20%20%20%20%20%20%20%20%24NewAdminExists%20%3D%20Get-AdUser%20-Identity%20%24newAdminName%0A%0A%23http%3A%2F%2Fblogs.msdn.com%2Fb%2Fopenspecification%2Farchive%2F2011%2F05%2F31%2Fwindows-configurations-for-kerberos-supported-encryption-type.aspx%0A%23%20’msDS-SupportedEncryptionTypes’%3D%20Kerberos%20DES%20Encryption%20%3D%202%2C%20Kerberos%20AES%20128%20%3D%208%2C%20Kerberos%20AES%20256%20%3D%2016%0A%20%20%20%20%20%20%20%20%7D%20%23end%20esle-if%20new%20user%20created%0A%0A%23%20Set%20the%20Protect%20against%20accidental%20deletions%20attribute%0A%20%20%20%20%20%20%20%20Get-AdUser%20-Identity%20%24AdminName%20%7C%20Set-ADObject%20-ProtectedFromAccidentalDeletion%20%24true%0A%20%20%20%20%20%20%20%20%24NewAdminExists%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7C%20Set-ADObject%20-ProtectedFromAccidentalDeletion%20%24true%0A%0A%23%20Make%20it%20member%20of%20administrative%20groups%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Domain%20Admins’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Members%20%24NewAdminExists%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Enterprise%20Admins’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Members%20%24NewAdminExists%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Group%20Policy%20Creator%20Owners’%20%20%20%20%20%20%20%20%20%20%20%20-Members%20%24NewAdminExists%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Denied%20RODC%20Password%20Replication%20Group’%20-Members%20%24NewAdminExists%0A%0A%23%23%23%23%0A%23%20Remove%20Everyone%20group%20from%20Admin-User%20%26%20Administrator%0A%20%20%20%20%20%20%20%20Remove-Everyone%20-LDAPPath%20%24NewAdminExists.DistinguishedName%0A%20%20%20%20%20%20%20%20Remove-Everyone%20-LDAPPath%20(‘CN%3D%7B0%7D%2C%7B1%7D’%20-f%20%24AdminName%2C%20%24ItAdminAccountsOuDn)%0A%0A%23%23%23%23%0A%23%20Remove%20AUTHENTICATED%20USERS%20group%20from%20Admin-User%20%26%20Administrator%0A%23Remove-AuthUser%20-LDAPPath%20%24NewAdminExists.DistinguishedName%0A%23Remove-AuthUser%20-LDAPPath%20(‘CN%3D%7B0%7D%2C%7B1%7D’%20-f%20%24AdminName%2C%20%24ItAdminAccountsOuDn)%0A%0A%23%23%23%23%0A%23%20Remove%20Pre-Windows%202000%20Compatible%20Access%20group%20from%20Admin-User%20%26%20Administrator%0A%20%20%20%20%20%20%20%20Remove-PreWin2000%20-LDAPPath%20%24NewAdminExists.DistinguishedName%0A%20%20%20%20%20%20%20%20Remove-PreWin2000%20-LDAPPath%20(‘CN%3D%7B0%7D%2C%7B1%7D’%20-f%20%24AdminName%2C%20%24ItAdminAccountsOuDn)%0A%0A%23%23%23%0A%23%20Configure%20TheGood%20account%0A%20%20%20%20%20%20%20%20%24params%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20’employeeType’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.NC.AdminAccSufix0%0A%20%20%20%20%20%20%20%20%20%20%20%20’msNpAllowDialin’%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24false%0A%20%20%20%20%20%20%20%20%20%20%20%20’msDS-SupportedEncryptionTypes’%20%3D%2024%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20Set-AdUser%20-Identity%20%24AdminName%20-TrustedForDelegation%20%24false%20-AccountNotDelegated%20%24true%20-Add%20%24params%3C%2Fcode%3E” provider=”manual” lang=”php”/]Creating Groups
Now that we have the corresponding containers, we will start creating the corresponding groups (Global & Domain Local). Starting table contains the required Global Groups
Security Principal | Description |
---|---|
SG_InfraAdmins | Full rights on all Active Directory infrastructure |
SG_ADAdmins | Partial rights on all Active Directory infrastructure |
SG_T0SA | Service Account for Tier 0 / Admin Area |
SG_T1SA | Service Account for Tier 1 / Servers Area |
SG_T2SA | Service Account for Tier 2 / Sites Area |
SG_Tier0Admins | Administrators group for Tier 0 / Admin Area |
SG_Tier1Admins | Administrators group for Tier 1 / Servers Area |
SG_Tier2Admins | Administrators group for Tier 2 / Sites Area |
SG_DfsAdmin | Full Rights to administer DFS |
SG_GpoAdmin | Full Rights to administer GPO |
SG_PkiAdmin | Full Rights to administer CA |
SG_PkiTemplateAdmin | Full Rights to administer CA Templates |
SG_AllGalAdmins | Delegated Limited general rights on all sites |
SG_AllSiteAdmins | Limited general rights on all sites |
SG_Operation | Limited rights on all Servers |
SG_ServiceDesk | Password rights and AllGALAdmin rights on all sites |
SG_ServerAdmin | Full administrative rights on servers |
SG_GlobalGroupAdmin | Full Group administrative rights on all sites |
SG_GlobalUserAdmin | Full user administrative rights on all sites |
SG_GlobalPcAdmin | Full computer administrative rights on all sites |
This is the list of Domain Local required groups
Security Principal | Description |
---|---|
SL_InfraRights | Delegated full rights to all AD infrastructure |
SL_AdRights | Delegated partial rights to all AD infrastructure |
SL_PUM | Rights for Privileged User management |
SL_PGM | Right for Privileged Group management |
SL_PISM | Right for Privileged Infrastructure management |
SL_PAWM | Right for Privileged Access Workstation management |
SL_DirReplRights | Right for Privileged Directory Replication Rights |
SL_PkiRights | Right for Privileged Public Key Infrastructure management |
SL_PkiTemplateRights | Right for Privileged Public Key Infrastructure Template management |
SL_DfsRights | Right for Privileged DFS management |
SL_GpoAdminRights | Right for Privileged GPO management |
SL_UM | Rights for User Management |
SL_GM | Rights for Group Management |
SL_PSAM | Rights for Service Account Management |
SL_InfrastructureServers | Rights for ALL Infrastructure Servers |
SL_PAWs | Rights for ALL PAWs |
SL_SvrAdmRight | Rights for server management |
SL_SvrOpsRight | Rights for server operation management |
SL_GlobalAppAccUserRight | Rights for Global Aplication Access Users |
SL_GlobalGroupRight | Rights for Global Group Management |
Same as we did for OUs, there is a wrapper function for creating groups.
New-AdDelegatedGroup
Native New-AdGroup throws an error exception when the group already exists. This error is handled as a “correct” within this function due the fact that group might already exist and operation should continue, having the existing group modified. The function also can take care of removing unneeded groups, as Account Operators; or set the “Protect from accidental deletion” flag.
[pastacode manual=”%3Ccode%3E%20%24splat%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Name%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’Poor%20Admins’%0A%20%20%20%20%20%20%20%20%20%20%20%20GroupCategory%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’Security’%0A%20%20%20%20%20%20%20%20%20%20%20%20GroupScope%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’DomainLocal’%0A%20%20%20%20%20%20%20%20%20%20%20%20DisplayName%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’Poor%20Admins’%0A%20%20%20%20%20%20%20%20%20%20%20%20Path%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’OU%3DGroups%2COU%3DAdmin%2CDC%3DEguibarIT%2CDC%3Dlocal’%0A%20%20%20%20%20%20%20%20%20%20%20%20Description%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20’New%20Admin%20Group’%0A%20%20%20%20%20%20%20%20%20%20%20%20ProtectFromAccidentalDeletion%20%3D%20%24true%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20New-AdDelegatedGroup%20%40Splat%3C%2Fcode%3E” provider=”manual” lang=”php”/]This wrapper function uses some CMDLets from EguibarIT.Delegation PowerShell Module
Used Functions:
Name | Module
————————-|————————–
Get-CurrentErrorToDisplay | EguibarIT
Remove-AccountOperator | EguibarIT.Delegation
Remove-Everyone | EguibarIT.Delegation
Remove-AuthUser | EguibarIT.Delegation
Remove-PreWin2000 | EguibarIT.Delegation
Fine Grained Password Policy
The Default Domain Policy is not enough to secure Privileged & Semi-Privileged accounts. Instead create a Fine Grained Password policy and assign it to privileged admin accounts and groups. Same will be for Service Accounts
[pastacode manual=”%3Ccode%3E%20%24PSOexists%20%3D%20%24null%0A%0A%20%20%20%20%20%20%20%20%26%2391%3BString%5D%24PsoName%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.Name%0A%0A%20%20%20%20%20%20%20%20%24PSOexists%20%3D%20Get-ADFineGrainedPasswordPolicy%20-Filter%20%7B%20name%20-eq%20%24PsoName%20%7D%0A%0A%20%20%20%20%20%20%20%20if(-not(%24PSOexists))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Name%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.Name%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Precedence%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.Precedence%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20ComplexityEnabled%20%20%20%20%20%20%20%20%20%20%20%3D%20%26%2391%3BSystem.Boolean%5D%24confXML.n.Admin.PSOs.ItAdminsPSO.ComplexityEnabled%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Description%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.Description%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20DisplayName%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.DisplayName%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20LockoutDuration%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.LockoutDuration%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20LockoutObservationWindow%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.LockoutObservationWindow%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20LockoutThreshold%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.LockoutThreshold%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20MaxPasswordAge%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.MaxPasswordAge%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20MinPasswordAge%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.MinPasswordAge%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20MinPasswordLength%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.MinPasswordLength%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20PasswordHistoryCount%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ItAdminsPSO.PasswordHistoryCount%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20ReversibleEncryptionEnabled%20%3D%20%26%2391%3BSystem.Boolean%5D%24confXML.n.Admin.PSOs.ItAdminsPSO.ReversibleEncryptionEnabled%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20New-ADFineGrainedPasswordPolicy%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%24PSOexists%20%3D%20Get-ADFineGrainedPasswordPolicy%20-Filter%20%7B%20name%20-eq%20%24PsoName%20%7D%0A%20%20%20%20%20%20%20%20%7D%20%23%20End%20If%20PSO%20exists%0A%0A%0A%20%20%20%20%20%20%20%20%23%20Apply%20the%20PSO%20to%20the%20corresponding%20accounts%20and%20groups%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40(%20%24AdminName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24newAdminName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’Domain%20Admins’%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’Enterprise%20Admins’%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_InfraAdmins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_AdAdmins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GpoAdmins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier0Admins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier1Admins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier2Admins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Operations.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_ServerAdmins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_AllSiteAdmins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_AllGALAdmins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GlobalUserAdmins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GlobalPcAdmins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GlobalGroupAdmins.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_ServiceDesk.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_InfraRight.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_AdRight.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_UM.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_GM.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PUM.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PGM.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_GpoAdminRight.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_DnsAdminRight.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_DirReplRight.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PromoteDcRight.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_TransferFSMOright.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PISM.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PAWM.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PSAM.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_SvrAdmRight.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_SvrOpsRight.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_GlobalGroupRight.SamAccountName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_GlobalAppAccUserRight.SamAccountName%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20Add-ADFineGrainedPasswordPolicySubject%20-Identity%20%24PSOexists%20-Subjects%20%24parameters%3C%2Fcode%3E” provider=”manual” lang=”php”/] [pastacode manual=”%3Ccode%3E%24PSOexists%20%3D%20%24null%0A%0A%0A%20%20%20%20%20%20%20%20%26%2391%3BString%5D%24PsoName%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.Name%0A%0A%20%20%20%20%20%20%20%20%24PSOexists%20%3D%20Get-ADFineGrainedPasswordPolicy%20-Filter%20%7B%20name%20-eq%20%24PsoName%20%7D%0A%0A%20%20%20%20%20%20%20%20if(-not(%24PSOexists))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Name%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.Name%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Precedence%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.Precedence%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20ComplexityEnabled%20%20%20%20%20%20%20%20%20%20%20%3D%20%26%2391%3BSystem.Boolean%5D%24confXML.n.Admin.PSOs.ServiceAccountsPSO.ComplexityEnabled%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20Description%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.Description%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20DisplayName%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.DisplayName%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20LockoutDuration%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.LockoutDuration%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20LockoutObservationWindow%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.LockoutObservationWindow%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20LockoutThreshold%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.LockoutThreshold%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20MaxPasswordAge%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.MaxPasswordAge%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20MinPasswordAge%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.MinPasswordAge%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20MinPasswordLength%20%20%20%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.MinPasswordLength%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20PasswordHistoryCount%20%20%20%20%20%20%20%20%3D%20%24confXML.n.Admin.PSOs.ServiceAccountsPSO.PasswordHistoryCount%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20ReversibleEncryptionEnabled%20%3D%20%26%2391%3BSystem.Boolean%5D%24confXML.n.Admin.PSOs.ServiceAccountsPSO.ReversibleEncryptionEnabled%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20New-ADFineGrainedPasswordPolicy%20%40parameters%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%24PSOexists%20%3D%20Get-ADFineGrainedPasswordPolicy%20-Filter%20%7B%20cn%20-eq%20%24PsoName%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%24PSOexists%20%3D%20Get-ADFineGrainedPasswordPolicy%20-Identity%20%24PsoName%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%23%20Apply%20the%20PSO%20to%20all%20Tier%20Service%20Accounts%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40(%20%24SG_Tier0ServiceAccount%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier1ServiceAccount%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier2ServiceAccount%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20Add-ADFineGrainedPasswordPolicySubject%20-Identity%20%24PSOexists%20-Subjects%20%24parameters%0A%0A%20%20%20%20%20%20%20%20%23endregion%3C%2Fcode%3E” provider=”manual” lang=”php”/]Group Nesting
There is a lot to do when nesting groups. Instead, the following image will describe quite good the following PowerShell nesting code.

Same as other cases already mentioned, there is a wrapper function for group nesting. This is the same as Add-AdGroupMember but with error handling, managing duplicates an “already member” and logging.
[pastacode manual=”%3Ccode%3E%23Nest%20Groups%20-%20Security%20for%20RODC%0A%20%20%20%20%20%20%20%20%23%20Avoid%20having%20privileged%20or%20semi-privileged%20groups%20copy%20to%20RODC%0A%0A%20%20%20%20%20%20%20%20Write-Verbose%20-Message%20’Nesting%20groups…’%0A%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40(%20%24AdminName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24newAdminName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’Domain%20Admins’%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20’Enterprise%20Admins’%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_InfraAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_AdAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GpoAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier0Admins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier1Admins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier2Admins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier0ServiceAccount%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier1ServiceAccount%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier2ServiceAccount%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Operations%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_ServerAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_AllSiteAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_AllGALAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GlobalUserAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GlobalPcAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GlobalGroupAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_ServiceDesk%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_InfraRight%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_AdRight%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_UM%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_GM%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PUM%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PGM%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_GpoAdminRight%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_DnsAdminRight%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_DirReplRight%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PromoteDcRight%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_TransferFSMOright%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PISM%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PAWM%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_PSAM%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_SvrAdmRight%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_SvrOpsRight%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_GlobalGroupRight%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SL_GlobalAppAccUserRight%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Denied%20RODC%20Password%20Replication%20Group’%20-Members%20%24parameters%0A%0A%23region%20Nest%20Groups%20-%20Delegate%20Rights%20through%20Builtin%20groups%0A%20%20%20%20%20%20%20%20%23%20http%3A%2F%2Fblogs.technet.com%2Fb%2Flrobins%2Farchive%2F2011%2F06%2F23%2Fquot-admin-free-quot-active-directory-and-windows-part-1-understanding-privileged-groups-in-ad.aspx%0A%20%20%20%20%20%20%20%20%23%20http%3A%2F%2Fblogs.msmvps.com%2Facefekay%2F2012%2F01%2F06%2Fusing-group-nesting-strategy-ad-best-practices-for-group-strategy%2F%0A%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Cryptographic%20Operators’%20-Members%20%24SG_AdAdmins%0A%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Network%20Configuration%20Operators’%20-Members%20%24SG_AdAdmins%0A%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20DnsAdmins%20-Members%20%24SG_AdAdmins%0A%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Event%20Log%20Readers’%20-Members%20%24SG_AdAdmins%2C%20%24SG_Operations%0A%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Performance%20Log%20Users’%20-Members%20%24SG_AdAdmins%2C%20%24SG_Operations%0A%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Performance%20Monitor%20Users’%20-Members%20%24SG_AdAdmins%2C%20%24SG_Operations%0A%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Remote%20Desktop%20Users’%20-Members%20%24SG_AdAdmins%0A%0A%20%20%20%20%20%20%20%20%23%20https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fdn466518(v%3Dws.11).aspx%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40(%24AdminName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24NewAdminName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_InfraAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_AdAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GpoAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier0Admins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier1Admins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Tier2Admins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_Operations%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_ServerAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_AllSiteAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_AllGALAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GlobalUserAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GlobalPcAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_GlobalGroupAdmins%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24SG_ServiceDesk%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20-Identity%20’Protected%20Users’%20-Members%20%24parameters%0A%0A%23endregion%0A%23region%20Nest%20Groups%20-%20Extend%20Rights%20through%20delegation%20model%20groups%0A%20%20%20%20%20%20%20%20%23%20http%3A%2F%2Fblogs.msmvps.com%2Facefekay%2F2012%2F01%2F06%2Fusing-group-nesting-strategy-ad-best-practices-for-group-strategy%2F%0A%0A%20%20%20%20%20%20%20%20%23%20InfraAdmins%20as%20member%20of%20InfraRight%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_InfraRight%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_InfraAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20InfraAdmins%20as%20member%20of%20PUM%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_PUM%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_InfraAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20InfraAdmins%20as%20member%20of%20PGM%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_PGM%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_InfraAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20InfraAdmins%20as%20member%20of%20PISM%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_PISM%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_InfraAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20InfraAdmins%20as%20member%20of%20PAWM%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_PAWM%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_InfraAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20InfraAdmins%20as%20member%20of%20PSAM%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_PSAM%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_InfraAdmins.SamAccountName%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20InfraAdmins%20as%20member%20of%20Tier0Admins%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SG_Tier0Admins.SamAccountName%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_InfraAdmins.SamAccountName%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20InfraAdmins%20as%20member%20of%20DirReplRight%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_DirReplRight.SamAccountName%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_InfraAdmins.SamAccountName%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20InfraAdmins%20as%20member%20of%20AdAdmins%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SG_AdAdmins%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_InfraAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%0A%0A%20%20%20%20%20%20%20%20%23%20AdAdmins%20as%20member%20of%20AdRight%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_AdRight%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_AdAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20AdAdmins%20as%20member%20of%20UM%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_UM%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_AdAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20AdAdmins%20as%20member%20of%20GM%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_GM%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_AdAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20AdAdmins%20as%20member%20of%20GpoAdmins%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SG_GpoAdmins%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_AdAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20AdAdmins%20as%20member%20of%20AllSiteAdmins%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SG_AllSiteAdmins%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_AdAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20AdAdmins%20as%20member%20of%20ServerAdmins%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SG_ServerAdmins%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_AdAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%0A%0A%20%20%20%20%20%20%20%20%23%20GpoAdmins%20as%20member%20of%20GpoAdminRight%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_GpoAdminRight%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_GpoAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%0A%0A%20%20%20%20%20%20%20%20%23%20AllSiteAdmins%20as%20member%20of%20AllGalAdmins%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SG_AllGALAdmins%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_AllSiteAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20AllGalAdmins%20as%20member%20of%20ServiceDesk%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SG_ServiceDesk%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_AllGALAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%0A%0A%20%20%20%20%20%20%20%20%23%20ServerAdmins%20as%20member%20of%20SvrAdmRight%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_SvrAdmRight%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_ServerAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Operations%20as%20member%20of%20SvrOpsRight%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SL_SvrOpsRight%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_Operations%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20ServerAdmins%20as%20member%20of%20Operations%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Identity%20%3D%20%24SG_Operations%0A%20%20%20%20%20%20%20%20%20%20%20%20Members%20%20%3D%20%24SG_ServerAdmins%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Add-AdGroupNesting%20%40parameters%3C%2Fcode%3E” provider=”manual” lang=”php”/]Modify AdminSdHolder
Delegation Model defines 2 “Privileged” groups which can modify privileged users and privileged groups respectively. In other word, a “Privileged User Manager (PUM)” group that its members cam change Domain Administrators (DA) without being members of the group. Same way, “Privileged Group Management (PGM) can change “Domain Admins”, “Enterprise Admins”, etc. without being a DA. EguibarIT.Delegation PowerShell Module provides 2 CMDLets for these purposes.
[pastacode manual=”%3Ccode%3E%20%23Enabling%20Management%20Accounts%20to%20Modify%20the%20Membership%20of%20Protected%20Groups%0A%0A%20%20%20%20%20%20%20%20%23%20Enable%20PUM%20to%20manage%20Privileged%20Accounts%20(Reset%20PWD%2C%20enable%2Fdisable%20Administrator%20built-in%20account)%0A%20%20%20%20%20%20%20%20Set-AdAclMngPrivilegedAccounts%20-Group%20%24SL_PUM.SamAccountName%0A%0A%20%20%20%20%20%20%20%20%23%20Enable%20PGM%20to%20manage%20Privileged%20Groups%20(Administrators%2C%20Domain%20Admins…)%0A%20%20%20%20%20%20%20%20Set-AdAclMngPrivilegedGroups%20-Group%20%24SL_PGM.SamAccountName%3C%2Fcode%3E” provider=”manual” lang=”php”/]Default Container Redirection
Default location for computers and users in AD is a simple folder; in other words, no specific GPO can be linked to these containers… something not good. This configuration section will create 2 OUs (Quarantine-Users & Quarantine-PCs), set the corresponding LOKDOWN GPO’s and have redirected the default location for each. Final result is that whenever a computer is domain joined without pre-staging the computer object (or without providing LDAP path destination while joining), it will end up in these new container; similar will happen to users.
[pastacode manual=”%3Ccode%3E%23redirect%20Users%20%26%20Computers%20containers%0A%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24ItQuarantineOu%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-ouPath%20%24AdDn%20-ouDescription%20%24confXML.n.Admin.OUs.ItNewComputersOU.description%20-RemoveAuthenticatedUsers%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24confXML.n.Admin.OUs.ItNewUsersOU.Name%20-ouPath%20%24AdDn%20-ouDescription%20%24confXML.n.Admin.OUs.ItNewUsersOU.description%20%20%20%20%20-RemoveAuthenticatedUsers%0A%0A%20%20%20%20%20%20%20%20%23%20START%20Remove%20Delegation%20to%20BuiltIn%20groups%20BEFORE%20REDIRECTION%0A%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Group%20%20%20%20%20%20%3D%20’Account%20Operators’%0A%20%20%20%20%20%20%20%20%20%20%20%20LDAPPath%20%20%20%3D%20’CN%3DComputers%2C%7B0%7D’%20-f%20%24AdDn%0A%20%20%20%20%20%20%20%20%20%20%20%20RemoveRule%20%3D%20%24True%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%23%23%23%20COMPUTERS%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20Users%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeleteUser%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20Computers%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeleteComputer%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20Groups%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeleteGroup%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20Contacts%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeleteContact%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20inetOrgPerson%0A%20%20%20%20%20%20%20%20Set-CreateDeleteInetOrgPerson%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20inetOrgPerson%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeletePrintQueue%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%24parameters%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Group%20%20%20%20%20%20%3D%20’Account%20Operators’%0A%20%20%20%20%20%20%20%20%20%20%20%20LDAPPath%20%20%20%3D%20’CN%3DUsers%2C%7B0%7D’%20-f%20%24AdDn%0A%20%20%20%20%20%20%20%20%20%20%20%20RemoveRule%20%3D%20%24True%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%23%23%23%20USERS%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20Users%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeleteUser%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20Computers%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeleteComputer%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20Groups%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeleteGroup%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20Contacts%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeleteContact%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Account%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20inetOrgPerson%0A%20%20%20%20%20%20%20%20Set-CreateDeleteInetOrgPerson%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%20Remove%20the%20Print%20Operators%20group%20from%20ACL%20to%20Create%2FDelete%20PrintQueues%0A%20%20%20%20%20%20%20%20Set-AdAclCreateDeletePrintQueue%20%40parameters%0A%0A%20%20%20%20%20%20%20%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A%23%20Redirect%20Default%20USER%20%26%20COMPUTERS%20Containers%0A%20%20%20%20%20%20%20%20redircmp.exe%20(‘OU%3D%7B0%7D%2C%7B1%7D’%20-f%20%24ItQuarantineOu%2C%20%24AdDn)%0A%20%20%20%20%20%20%20%20redirusr.exe%20(‘OU%3D%7B0%7D%2C%7B1%7D’%20-f%20%24confXML.n.Admin.OUs.ItNewUsersOU.Name%2C%20%24AdDn)%3C%2Fcode%3E” provider=”manual” lang=”php”/]Initial setup of Servers Area (Tier1)
Create Servers (or other previously defined name) OU subtree. If any sub-OU already exists, just proceed to clean it up (The CMDlet Start-AdCleanOU from module EguibarIT can be used for this propose). As we are creating OUs, we will follow the same approach as we did on Organizational Units needed to build Admin Area (Tier0). This area/tier will only contain computer objects representing servers; any other related object should go into Sites Area (Tier2) or Admin Area (Tier0).
[pastacode manual=”%3Ccode%3E%23%20SERVERS%20OU%20(area)%0A%0A%20%20%20%20%20%20%20%20Write-Verbose%20-Message%20’Creating%20Servers%20Area…’%0A%0A%20%20%20%20%20%20%20%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A%20%20%20%20%20%20%20%20%23%20Create%20Servers%20and%20Sub%20OUs%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24ServersOu%20-ouPath%20%24AdDn%20-ouDescription%20%24confXML.n.Servers.OUs.ServersOU.Description%0A%0A%20%20%20%20%20%20%20%20%23%20Create%20Sub-OUs%20for%20Servers%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24confXML.n.Servers.OUs.SqlOU.Name%20%20%20%20%20%20%20%20%20%20%20-ouPath%20%24ServersOuDn%20-ouDescription%20%24confXML.n.Servers.OUs.SqlOU.Description%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24confXML.n.Servers.OUs.WebOU.Name%20%20%20%20%20%20%20%20%20%20%20-ouPath%20%24ServersOuDn%20-ouDescription%20%24confXML.n.Servers.OUs.WebOU.Description%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24confXML.n.Servers.OUs.FileOU.Name%20%20%20%20%20%20%20%20%20%20-ouPath%20%24ServersOuDn%20-ouDescription%20%24confXML.n.Servers.OUs.FileOU.Description%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24confXML.n.Servers.OUs.ApplicationOU.Name%20%20%20-ouPath%20%24ServersOuDn%20-ouDescription%20%24confXML.n.Servers.OUs.ApplicationOU.Description%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24confXML.n.Servers.OUs.HypervOU.Name%20%20%20%20%20%20%20%20-ouPath%20%24ServersOuDn%20-ouDescription%20%24confXML.n.Servers.OUs.HypervOU.Description%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24confXML.n.Servers.OUs.RemoteDesktopOU.Name%20-ouPath%20%24ServersOuDn%20-ouDescription%20%24confXML.n.Servers.OUs.RemoteDesktopOU.Description%0A%3C%2Fcode%3E” provider=”manual” lang=”php”/]Create the required management groups (SG_SvrAdmin, SL_SvrServerRiht, SG_Operations & SL_SvrOpsRight) as defined on the Delegation Model.
Initial setup of Sites Area (Tier2)
Create Sites (or other previously defined name) OU subtree. If any sub-OU already exists, just proceed to clean it up (The CMDlet Start-AdCleanOU from module EguibarIT can be used for this propose). As we are creating OUs, we will follow the same approach as we did on Organizational Units needed to build Admin Area (Tier0). This area/tier will contain all remaining objects, meaning anything apart from Tier0 used for administration of the environment, and servers; any other related object should go into Servers Area (Tier1) or Admin Area (Tier0).
[pastacode manual=”%3Ccode%3E%20%23%20Create%20Sites%20OUs%20(Area)%0A%0A%20%20%20%20%20%20%20%20Write-Verbose%20-Message%20’Creating%20Sites%20Area…’%0A%0A%20%20%20%20%20%20%20%20New-DelegateAdOU%20-ouName%20%24SitesOu%20-ouPath%20%24AdDn%20-ouDescription%20%24confXML.n.Sites.OUs.SitesOU.Description%3C%2Fcode%3E” provider=”manual” lang=”php”/]As each and every site will be created individually, based on requirements, there is no need to create such administrative groups in advance.
Start with Delegations
Now that we have the right taxonomy & containers, and that we have the corresponding groups, we are ready to start delegating permissions and rights to these groups. We are halve the way on building our Admin Area (Tier0). Go to Delegating Admin Area (Tier0) page