Skip to content

Commit e331538

Browse files
Improvements
1 parent 010f552 commit e331538

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

Private/Domain/Get-WinADForestGUIDs.ps1

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
11
function Get-WinADForestGUIDs {
2+
<#
3+
.SYNOPSIS
4+
Short description
5+
6+
.DESCRIPTION
7+
Long description
8+
9+
.PARAMETER Domain
10+
Parameter description
11+
12+
.PARAMETER RootDSE
13+
Parameter description
14+
15+
.PARAMETER DisplayNameKey
16+
Parameter description
17+
18+
.EXAMPLE
19+
Get-WinADForestGUIDs
20+
21+
.EXAMPLE
22+
Get-WinADForestGUIDs -DisplayNameKey
23+
24+
.NOTES
25+
General notes
26+
#>
227
[alias('Get-WinADDomainGUIDs')]
328
[cmdletbinding()]
429
param(
530
[string] $Domain = $Env:USERDNSDOMAIN,
6-
[Microsoft.ActiveDirectory.Management.ADEntity] $RootDSE
31+
[Microsoft.ActiveDirectory.Management.ADEntity] $RootDSE,
32+
[switch] $DisplayNameKey
733
)
834
if ($null -eq $RootDSE) {
935
$RootDSE = Get-ADRootDSE -Server $Domain
@@ -17,7 +43,11 @@ function Get-WinADForestGUIDs {
1743
$GUID.add([System.GUID]$S.schemaIDGUID, $S.name)
1844
}
1945
#>
20-
$GUID["$(([System.GUID]$S.schemaIDGUID).Guid)"] = $S.name
46+
if ($DisplayNameKey) {
47+
$GUID["$($S.name)"] = $(([System.GUID]$S.schemaIDGUID).Guid)
48+
} else {
49+
$GUID["$(([System.GUID]$S.schemaIDGUID).Guid)"] = $S.name
50+
}
2151
}
2252

2353

@@ -28,7 +58,11 @@ function Get-WinADForestGUIDs {
2858
$GUID.add([System.GUID]$S.rightsGUID, $S.name)
2959
}
3060
#>
31-
$GUID["$(([System.GUID]$S.rightsGUID).Guid)"] = $S.name
61+
if ($DisplayNameKey) {
62+
$GUID["$($S.name)"] = $(([System.GUID]$S.rightsGUID).Guid)
63+
} else {
64+
$GUID["$(([System.GUID]$S.rightsGUID).Guid)"] = $S.name
65+
}
3266
}
3367
return $GUID
3468
}

0 commit comments

Comments
 (0)