-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-GPOOverview.ps1
More file actions
63 lines (44 loc) · 1.62 KB
/
Copy pathGet-GPOOverview.ps1
File metadata and controls
63 lines (44 loc) · 1.62 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<#PSScriptInfo
.DESCRIPTION Retrieves information about Group Policy Objects (GPOs) and their links.
.VERSION 1.0.0.0
.GUID d1d76bac-ca9a-4c7d-b17c-8ee58ac960f9
.AUTHOR Tom Stryhn
.COMPANYNAME Tom Stryhn
.COPYRIGHT 2024 (c) Tom Stryhn
.TAGS Microsoft Active Directory Group Policy Objects Overview Audit
.LICENSEURI https://github.com/tomstryhn/PowerShell/blob/main/LICENSE
.PROJECTURI https://github.com/tomstryhn/PowerShell/ActiveDirectory/Get-GPOOverview/
#>
function Get-GPOOverview {
<#
.SYNOPSIS
Retrieves information about Group Policy Objects (GPOs) and their links.
.DESCRIPTION
The Get-GPOOverview function generates a report for all GPOs in the domain, including details about links,
enabled links, and extension data (if available).
#>
# Generate the XML report for all GPOs
[xml]$allGPOs = Get-GPOReport -All -ReportType Xml
# Process each GPO
$allGPOs.GPOS.GPO | Foreach-Object {
$links = 0
$eLinks = 0
foreach($link in $PSItem.LinksTo) {
$links++
if(($link.Enabled -eq 'true') -or ($link.Enabled -eq 'True')) {
$eLinks++
}
}
# Creates PSCustom Output Object
$output = [PSCustomObject]@{
Name = $PSItem.Name
Links = $links
EnabledLinks = $eLinks
Computer = $PSItem.Computer.Enabled
ComputerData = if($PSItem.Computer.ExtensionData.Extension) { $true } else { $false }
User = $PSItem.User.Enabled
UserData = if($PSItem.User.ExtensionData.Extension) { $true } else { $false }
}
$output
}
}