Last active
November 9, 2016 17:00
-
-
Save IISResetMe/8917e9f47226044042f5 to your computer and use it in GitHub Desktop.
Clean out orphaned Group Policy Templates from SYSVOL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gci "\\$(($d=$env:USERDNSDOMAIN))\sysvol\$d\Policies"|?{$_.Name-imatch"^(?<g>\{[A-F\d]{8}(-[A-F\d]{4}){3}-[A-F\d]{12}\})$"}|?{[ADSI]::Exists("LDAP://CN=$($Matches["g"]),CN=Policies,CN=System,DC=$($d-split"\."-join",DC=")")}|%{"{0} is an orphan, remove it"-f$_.FullName} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment