July 24, 2016

Compare-GPOs.ps1 - comparing GPO version numbers across Domain Controllers

This PowerShell script compares Group Policy Objects versions between specified Domain Controllers. It is used to identify GPOs, which are not replicated properly or have versions mismatch.

As example I will use Active Directory domain called "AD.FEDENKO.INFO" and 2 domain controllers "DC01"and "DC02".

I will create a test Group Policy called "Test_GPO" shows below.

After some GPO settings amendments you can see that User and Computer versions are changed.

To simulate replication issue I will go to second domain controller and remove GPT.ini file.

As result you will see User and Computer versions are not available in Group Policy Management console of DC02.

Compare-GPOs PowerShell script can help to identify such Group Policy objects.

.\Compare-GPOs.ps1 -FirstDC DC01.AD.FEDENKO.INFO -SecondDC DC02.AD.FEDENKO.INFO


DCName                : DC02.AD.FEDENKO.INFO
Id                    : c1acca94-7078-403b-b636-7f9916aa4665
DisplayName           : Test_GPO
Path                  : cn={C1ACCA94-7078-403B-B636-7F9916AA4665},cn=policies,cn=system,DC=AD,DC=FEDENKO,DC=INFO
Owner                 : AD\Domain Admins
CreationTime          : 7/24/2016 4:41:12 PM
ModificationTime      : 7/24/2016 5:04:34 PM
UserDSVersion         : 2
UserSysvolVersion     :
ComputerDSVersion     : 1
ComputerSysvolVersion :
GpoStatus             : AllSettingsEnabled

DCName                : DC01.AD.FEDENKO.INFO
Id                    : c1acca94-7078-403b-b636-7f9916aa4665
DisplayName           : Test_GPO
Path                  : cn={C1ACCA94-7078-403B-B636-7F9916AA4665},cn=policies,cn=system,DC=AD,DC=FEDENKO,DC=INFO
Owner                 : AD\Domain Admins
CreationTime          : 7/24/2016 4:41:12 PM
ModificationTime      : 7/24/2016 5:03:00 PM
UserDSVersion         : 2
UserSysvolVersion     : 2
ComputerDSVersion     : 1
ComputerSysvolVersion : 1
GpoStatus             : AllSettingsEnabled

Also there is optional "-DelayInMilliseconds" parameter, which can be used for CPU usage throttling. The script can be downloaded from TechNet Gallery.

No comments:

Post a Comment