-
Notifications
You must be signed in to change notification settings - Fork 1
/
MapGuidsToGpoNames.ps1
43 lines (34 loc) · 1.22 KB
/
MapGuidsToGpoNames.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function Get-GuidToGpoName {
<#
.SYNOPSIS
This script maps GUIDs to GPO display names in the SYSVOL share on a domain controller.
.DESCRIPTION
This script looks at every GPO directory in a domain's SYSVOL share and
inspects the XML contents to map GUID directory names to GPO display names.
.PARAMETER Path
The path to the Policies directory in the SYSVOL share on a domain controller.
.EXAMPLE
Get-GuidToGpoName -Path \\dc1\sysvol\domain.com\Policies
This example will return a table of GPO display names and their corresponding GUIDs.
#>
[CmdletBinding()]
param(
[parameter(Mandatory=$true)]
[String]
$Path
)
begin {
}
process {
$Results = @{}
Get-ChildItem -Recurse -Include backup.xml $Path | ForEach-Object {
$GUID = $_.Directory.Name
$XML = [xml](Get-Content $_)
$DN = $XML.GroupPolicyBackupScheme.GroupPolicyObject.GroupPolicyCoreSettings.DisplayName.InnerText
$Results.Add($DN, $GUID)
}
$Results | Format-Table Name, Value -AutoSize
}
end {
}
}