Querying Group Policies
Active Directory in large environments contains policies ranging from a few tens to hundreds in number, based on need and usage criteria. These policies will be linked to multiple places in the Active Directory structure such as domains, OUs, and sites. The Get-GPO
cmdlet in the Group Policy module helps in querying the details of Group Policies at various levels.
To see all Group Policies in the current forest, you can use the following command:
Get-GPO -All
By default, all the Group Policy cmdlets contact the Primary Domain Controller (PDC) emulator to get these results. If you want to query the details from the local domain controller, you can pass the name of the domain controller with the -Server
parameter, using the following command:
Get-GPO -All -Server TIBDC2
Here, TIBDC2
is a domain controller in a local LAN. The output returned by this code contains name, Global Unique Identifier (GUID), Creation-Time, Modification-Time, and other details.
If you want to...