Detecting GPOs that have either no computer or user settings
These policies generally are meant for just computer or user settings. This script will disable the empty settings (for example, if a GPO has only computer setttings, it will disable user settings). This is important as it does speed up performance by not having to process empty policies.
Import-Module GroupPolicy $GPOs = Get-GPO -All foreach ($GPO in $GPOs) { if (($GPO.Computer.DSVersion -eq 0) -and ($GPO.GpoStatus -ne "ComputerSettingsDisabled")) { write-host $GPO.DisplayName has no computer settings and not disabled. Disabling... $GPO.GpoStatus="ComputerSettingsDisabled" } if (($GPO.User.DSVersion -eq 0) -and ($GPO.GpoStatus -ne "UserSettingsDisabled")) { write-host $GPO.DisplayName has no user settings and not disabled. Disabling... $GPO.GpoStatus="UserSettingsDisabled" } }