Compare commits

..

30 Commits

Author SHA1 Message Date
Przemyslaw Klys 231c2951e0 Update changelog 2022-10-20 08:47:50 +02:00
Przemyslaw Klys faea9753ae Bump versions 2022-10-20 08:45:13 +02:00
Przemyslaw Klys 4c49406a6c Update changelog 2022-10-20 08:44:58 +02:00
Przemyslaw Klys f3d73abed4 Fixes additional space #31 2022-10-20 08:43:43 +02:00
Przemyslaw Klys 620ce6cd61 Fixes #33 2022-10-20 08:36:11 +02:00
Przemyslaw Klys b336f73eda Fixes SplitReports 2022-09-12 22:16:20 +02:00
Przemyslaw Klys bfefb7f943 Update changelog 2022-09-12 22:14:39 +02:00
Przemyslaw Klys 18226c172a Bump version 2022-09-12 22:14:32 +02:00
Przemyslaw Klys 3320b26bd4 Update docs 2022-09-11 23:17:53 +02:00
Przemyslaw Klys ec91c69673 moved to a different directory 2022-09-11 23:17:46 +02:00
Przemyslaw Klys 31e9b3b4d3 Add docs for anotehr command 2022-09-11 23:17:37 +02:00
Przemyslaw Klys d7eedc97b9 Update module builder 2022-09-11 23:17:28 +02:00
Przemyslaw Klys 42d3ba67dc Update PSD1 2022-09-11 23:17:14 +02:00
Przemyslaw Klys cdc9c1cbc5 Update changelog 2022-09-11 22:34:02 +02:00
Przemyslaw Klys de28c53842 Example on new function 2022-09-11 22:32:57 +02:00
Przemyslaw Klys be0be57994 Udate changelog 2022-09-11 22:32:44 +02:00
Przemyslaw Klys 652f553e71 Update example 2022-09-11 22:32:39 +02:00
Przemyslaw Klys 5d2a4725f1 move html to separate functions
fix splitreports to start creating reports right away
2022-09-11 22:30:55 +02:00
Przemyslaw Klys 4081a5ead1 Add new function to export XMLs 2022-09-11 22:28:16 +02:00
Przemyslaw Klys 796c69de37 Update examples 2022-09-11 22:28:04 +02:00
Przemyslaw Klys 9929d827f5 Disabled tests that are deprecated 2022-07-27 12:41:07 +02:00
Przemyslaw Klys 4781b91e23 Update changelog 2022-07-27 09:39:57 +02:00
Przemyslaw Klys 1ca78cf5f5 Disable deprecated reports if user doesn't ask for them 2022-07-27 09:37:35 +02:00
Przemyslaw Klys 768e32cf7e Update module builder 2022-07-26 21:51:14 +02:00
Przemyslaw Klys 0d43c4e809 Update changelog 2022-07-26 21:49:00 +02:00
Przemyslaw Klys ac4a9bb43d Added error handling 2022-07-26 21:47:57 +02:00
Przemyslaw Klys 0abde822f5 Add split reports functionality 2022-07-26 21:40:33 +02:00
Przemyslaw Klys bf3ec81ea6 Update docs 2022-07-26 21:40:22 +02:00
Przemyslaw Klys c0d1f4de1c Update changelog 2022-07-26 21:39:54 +02:00
Przemyslaw Klys 65719b8c4c Bump version 2022-07-26 21:39:48 +02:00
20 changed files with 316 additions and 65 deletions
@@ -1,5 +1,4 @@
Clear-Host
Import-Module "C:\Users\przemyslaw.klys\OneDrive - Evotec\Support\GitHub\PSPublishModule\PSPublishModule.psd1" -Force
$Configuration = @{
Information = @{
@@ -267,7 +266,7 @@ $Configuration = @{
RefreshPSD1Only = $false
}
BuildDocumentation = @{
Enable = $false # enables documentation processing
Enable = $true # enables documentation processing
StartClean = $true # always starts clean
UpdateWhenNew = $true # always updates right after new
}
@@ -277,10 +276,10 @@ $Configuration = @{
Verbose = $false
}
PublishModule = @{ # requires Enable to be on to process all of that
Enabled = $true
Enabled = $false
Prerelease = ''
RequireForce = $false
GitHub = $true
GitHub = $false
}
}
}
+17 -1
View File
@@ -1,9 +1,25 @@
# GPOZaurr Release History
## 0.0.154 - 2022.10.20
- Fixes `Invoke-GPOZaurr` SplitReports functionality (again!) [#33](https://github.com/EvotecIT/GPOZaurr/issues/33)
- Fixes Sysvol property in object returned by Get-GPOZaurrPermissionConsistency contains whitespace [#31](https://github.com/EvotecIT/GPOZaurr/issues/31)
## 0.0.153 - 2022.09.12
- Fixes `Invoke-GPOZaurr` SplitReports functionality that would generate main report anyways.
## 0.0.152 - 2022.09.11
- ️ Improved `Invoke-GPOZaurr` - disable deprecated reports if user doesn't ask for them but asks for all reports to be generated. Those reports are now disabled by default: GPOPermissionsAdministrative,GPOPermissionsRead,GPOPermissionsRoot,GPOPermissionsUnknown
- ️ Improved `Invoke-GPOZaurr` SplitReports functionality to start creating HTML reports every report
- Add `Export-GPOZaurrContent` to simplify quick export of all XML/HTML reports from GPO
## 0.0.151 - 2022.07.26
- ️ Improved `Invoke-GPOZaurr` by adding `SplitReports` functionality. This will allow you to split the reports into multiple files with a single request.
- ️ Improved `Get-GPOZaurrInheritance` with some error handling
## 0.0.150 - 2021.12.06
- ️ Improves `GPOUpdates` report from `Invoke-GPOZaurr` - additional property
## 0.0.149 - 2021.12.05
- Improved docs
- Improved docs
## 0.0.148 - 2021.12.05
- ☑ Improved `Invoke-GPOZaurr` - type `GPOOrganizationalUnit` - excludes default redirected computers/users OUs [#30](https://github.com/EvotecIT/GPOZaurr/issues/30)
- ☑ Improved `Get-GPOZaurrOrganizationalUnit` - excludes default redirected computers/users OUs as per [#30](https://github.com/EvotecIT/GPOZaurr/issues/30)
+73
View File
@@ -0,0 +1,73 @@
---
external help file: GPOZaurr-help.xml
Module Name: GPOZaurr
online version:
schema: 2.0.0
---
# Export-GPOZaurrContent
## SYNOPSIS
Saves GPOs to XML or HTML files.
## SYNTAX
```
Export-GPOZaurrContent [-FolderOutput] <String> [[-ReportType] <String>] [<CommonParameters>]
```
## DESCRIPTION
Saves GPOs to XML or HTML files.
## EXAMPLES
### EXAMPLE 1
```
An example
```
## PARAMETERS
### -FolderOutput
The folder where the GPOs will be saved.
```yaml
Type: String
Parameter Sets: (All)
Aliases: Path
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -ReportType
The type of report to generate.
Valid values are XML or HTML.
Default is XML.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: XML
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
## OUTPUTS
## NOTES
General notes
## RELATED LINKS
+17 -1
View File
@@ -15,7 +15,7 @@ Single cmdlet that provides 360 degree overview of Group Policies in Active Dire
```
Invoke-GPOZaurr [[-Exclusions] <Object>] [-FilePath <String>] [[-Type] <String[]>] [-PassThru] [-HideHTML]
[-HideSteps] [-ShowError] [-ShowWarning] [-Forest <String>] [-ExcludeDomains <String[]>]
[-IncludeDomains <String[]>] [-Online] [<CommonParameters>]
[-IncludeDomains <String[]>] [-Online] [-SplitReports] [<CommonParameters>]
```
## DESCRIPTION
@@ -224,6 +224,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -SplitReports
Split report into multiple files, one for each report.
This can be useful for large domains with huge reports.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+3
View File
@@ -26,6 +26,9 @@ Provides Backup functionality to Group Policies
### [ConvertFrom-CSExtension](ConvertFrom-CSExtension.md)
{{ Fill in the Synopsis }}
### [Export-GPOZaurrContent](Export-GPOZaurrContent.md)
Saves GPOs to XML or HTML files.
### [Find-CSExtension](Find-CSExtension.md)
{{ Fill in the Synopsis }}
+1 -1
View File
@@ -2,7 +2,7 @@
# This gets the same thing as earlier examples
# with a difference where one entry per gpo and all settings for that GPO is stored under settings property.
$Output = Invoke-GPOZaurrContent -SingleObject -Verbose
$Output = Invoke-GPOZaurrContent -Verbose #-SingleObject -Verbose
$Output | Format-Table
$Output.Reports.RegistrySettings | Format-Table *
$Output.Reports.RegistrySettings[0].Settings | Format-Table *
+1 -1
View File
@@ -1,4 +1,4 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
$Output = Invoke-GPOZaurrContent -Verbose -OutputType HTML, Object -Open -GPOPath "C:\Support\GitHub\GpoZaurr\Ignore\NewExamples" ##-Type LocalGroups
$Output = Invoke-GPOZaurrContent -SingleObject -Verbose -OutputType HTML, Object -Open -GPOPath "C:\Users\przemyslaw.klys\OneDrive - Evotec\Desktop\Test"
$Output | Format-Table
+1 -1
View File
@@ -1,3 +1,3 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
Invoke-GPOZaurr -Type GPOUpdates -Online -Verbose #-IncludeDomains 'ad.evotec.pl'
Invoke-GPOZaurr -Online -Verbose -FilePath $PSScriptRoot\Reports\GPOZaurr.html -SplitReports
+3
View File
@@ -0,0 +1,3 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
Export-GPOZaurrContent -FolderOutput $PSScriptRoot\ExportedXML -ReportType XML
+6 -6
View File
@@ -4,11 +4,11 @@
CmdletsToExport = @()
CompanyName = 'Evotec'
CompatiblePSEditions = @('Desktop')
Copyright = '(c) 2011 - 2021 Przemyslaw Klys @ Evotec. All rights reserved.'
Copyright = '(c) 2011 - 2022 Przemyslaw Klys @ Evotec. All rights reserved.'
Description = 'Group Policy Eater is a PowerShell module that aims to gather information about Group Policies but also allows fixing issues that you may find in them.'
FunctionsToExport = @('Add-GPOPermission', 'Add-GPOZaurrPermission', 'Backup-GPOZaurr', 'Clear-GPOZaurrSysvolDFSR', 'ConvertFrom-CSExtension', 'Find-CSExtension', 'Get-GPOZaurr', 'Get-GPOZaurrAD', 'Get-GPOZaurrBackupInformation', 'Get-GPOZaurrBroken', 'Get-GPOZaurrBrokenLink', 'Get-GPOZaurrDictionary', 'Get-GPOZaurrDuplicateObject', 'Get-GPOZaurrFiles', 'Get-GPOZaurrFilesPolicyDefinition', 'Get-GPOZaurrFolders', 'Get-GPOZaurrInheritance', 'Get-GPOZaurrLegacyFiles', 'Get-GPOZaurrLink', 'Get-GPOZaurrLinkSummary', 'Get-GPOZaurrNetLogon', 'Get-GPOZaurrOrganizationalUnit', 'Get-GPOZaurrOwner', 'Get-GPOZaurrPassword', 'Get-GPOZaurrPermission', 'Get-GPOZaurrPermissionAnalysis', 'Get-GPOZaurrPermissionConsistency', 'Get-GPOZaurrPermissionIssue', 'Get-GPOZaurrPermissionRoot', 'Get-GPOZaurrPermissionSummary', 'Get-GPOZaurrSysvolDFSR', 'Get-GPOZaurrUpdates', 'Get-GPOZaurrWMI', 'Invoke-GPOZaurr', 'Invoke-GPOZaurrContent', 'Invoke-GPOZaurrPermission', 'Invoke-GPOZaurrSupport', 'New-GPOZaurrWMI', 'Optimize-GPOZaurr', 'Remove-GPOPermission', 'Remove-GPOZaurr', 'Remove-GPOZaurrBroken', 'Remove-GPOZaurrDuplicateObject', 'Remove-GPOZaurrFolders', 'Remove-GPOZaurrLegacyFiles', 'Remove-GPOZaurrLinkEmptyOU', 'Remove-GPOZaurrPermission', 'Remove-GPOZaurrWMI', 'Repair-GPOZaurrBrokenLink', 'Repair-GPOZaurrNetLogonOwner', 'Repair-GPOZaurrPermission', 'Repair-GPOZaurrPermissionConsistency', 'Restore-GPOZaurr', 'Save-GPOZaurrFiles', 'Set-GPOOwner', 'Set-GPOZaurrOwner', 'Set-GPOZaurrStatus', 'Skip-GroupPolicy')
FunctionsToExport = @('Add-GPOPermission', 'Add-GPOZaurrPermission', 'Backup-GPOZaurr', 'Clear-GPOZaurrSysvolDFSR', 'ConvertFrom-CSExtension', 'Export-GPOZaurrContent', 'Find-CSExtension', 'Get-GPOZaurr', 'Get-GPOZaurrAD', 'Get-GPOZaurrBackupInformation', 'Get-GPOZaurrBroken', 'Get-GPOZaurrBrokenLink', 'Get-GPOZaurrDictionary', 'Get-GPOZaurrDuplicateObject', 'Get-GPOZaurrFiles', 'Get-GPOZaurrFilesPolicyDefinition', 'Get-GPOZaurrFolders', 'Get-GPOZaurrInheritance', 'Get-GPOZaurrLegacyFiles', 'Get-GPOZaurrLink', 'Get-GPOZaurrLinkSummary', 'Get-GPOZaurrNetLogon', 'Get-GPOZaurrOrganizationalUnit', 'Get-GPOZaurrOwner', 'Get-GPOZaurrPassword', 'Get-GPOZaurrPermission', 'Get-GPOZaurrPermissionAnalysis', 'Get-GPOZaurrPermissionConsistency', 'Get-GPOZaurrPermissionIssue', 'Get-GPOZaurrPermissionRoot', 'Get-GPOZaurrPermissionSummary', 'Get-GPOZaurrSysvolDFSR', 'Get-GPOZaurrUpdates', 'Get-GPOZaurrWMI', 'Invoke-GPOZaurr', 'Invoke-GPOZaurrContent', 'Invoke-GPOZaurrPermission', 'Invoke-GPOZaurrSupport', 'New-GPOZaurrWMI', 'Optimize-GPOZaurr', 'Remove-GPOPermission', 'Remove-GPOZaurr', 'Remove-GPOZaurrBroken', 'Remove-GPOZaurrDuplicateObject', 'Remove-GPOZaurrFolders', 'Remove-GPOZaurrLegacyFiles', 'Remove-GPOZaurrLinkEmptyOU', 'Remove-GPOZaurrPermission', 'Remove-GPOZaurrWMI', 'Repair-GPOZaurrBrokenLink', 'Repair-GPOZaurrNetLogonOwner', 'Repair-GPOZaurrPermission', 'Repair-GPOZaurrPermissionConsistency', 'Restore-GPOZaurr', 'Save-GPOZaurrFiles', 'Set-GPOOwner', 'Set-GPOZaurrOwner', 'Set-GPOZaurrStatus', 'Skip-GroupPolicy')
GUID = 'f7d4c9e4-0298-4f51-ad77-e8e3febebbde'
ModuleVersion = '0.0.150'
ModuleVersion = '0.0.154'
PowerShellVersion = '5.1'
PrivateData = @{
PSData = @{
@@ -18,15 +18,15 @@
}
}
RequiredModules = @(@{
ModuleVersion = '0.0.214'
ModuleVersion = '0.0.248'
ModuleName = 'PSSharedGoods'
Guid = 'ee272aa8-baaa-4edf-9f45-b6d6f7d844fe'
}, @{
ModuleVersion = '0.0.138'
ModuleVersion = '0.0.148'
ModuleName = 'ADEssentials'
Guid = '9fc9fd61-7f11-4f4b-a527-084086f1905f'
}, @{
ModuleVersion = '0.0.164'
ModuleVersion = '0.0.179'
ModuleName = 'PSWriteHTML'
Guid = 'a7bdf640-f5cb-4acf-9de0-365b322d245c'
}, 'CimCmdlets', 'Microsoft.PowerShell.Management', 'Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.Security')
@@ -1,6 +1,6 @@
$GPOZaurrPermissionsAdministrative = [ordered] @{
Name = 'Group Policy Administrative Permissions'
Enabled = $true
Enabled = $false
Action = $null
Data = $null
Execute = {
+1 -1
View File
@@ -1,6 +1,6 @@
$GPOZaurrPermissionsRead = [ordered] @{
Name = 'Group Policy Authenticated Users Permissions'
Enabled = $true
Enabled = $false
Action = $null
Data = $null
Execute = {
+1 -1
View File
@@ -1,6 +1,6 @@
$GPOZaurrPermissionsRoot = [ordered] @{
Name = 'Group Policies Root Permissions'
Enabled = $true
Enabled = $false
Action = $null
Data = $null
Execute = {
@@ -1,6 +1,6 @@
$GPOZaurrPermissionsUnknown = [ordered] @{
Name = 'Group Policy Unknown Permissions'
Enabled = $true
Enabled = $false
Action = $null
Data = $null
Execute = {
+50
View File
@@ -0,0 +1,50 @@
function New-HTMLReportAll {
[CmdletBinding()]
param(
[string] $FilePath,
[switch] $Online,
[switch] $HideHTML,
[Array] $Type
)
# Standard reports as requested
Write-Color -Text '[i]', '[HTML ] ', "Generating HTML report ($FilePath)" -Color Yellow, DarkGray, Yellow
New-HTML -Author 'Przemysław Kłys @ Evotec' -TitleText 'GPOZaurr Report' {
New-HTMLTabStyle -BorderRadius 0px -TextTransform capitalize -BackgroundColorActive SlateGrey
New-HTMLSectionStyle -BorderRadius 0px -HeaderBackGroundColor Grey -RemoveShadow
New-HTMLPanelStyle -BorderRadius 0px
New-HTMLTableOption -DataStore JavaScript -BoolAsString -ArrayJoinString ', ' -ArrayJoin
New-HTMLHeader {
New-HTMLSection -Invisible {
New-HTMLSection {
New-HTMLText -Text "Report generated on $(Get-Date)" -Color Blue
} -JustifyContent flex-start -Invisible
New-HTMLSection {
New-HTMLText -Text "GPOZaurr - $($Script:Reporting['Version'])" -Color Blue
} -JustifyContent flex-end -Invisible
}
}
if ($Type.Count -eq 1) {
foreach ($T in $Script:GPOConfiguration.Keys) {
if ($Script:GPOConfiguration[$T].Enabled -eq $true) {
if ($Script:GPOConfiguration[$T]['Summary']) {
$Script:Reporting[$T]['Summary'] = Invoke-Command -ScriptBlock $Script:GPOConfiguration[$T]['Summary']
}
& $Script:GPOConfiguration[$T]['Solution']
}
}
} else {
foreach ($T in $Script:GPOConfiguration.Keys) {
if ($Script:GPOConfiguration[$T].Enabled -eq $true) {
if ($Script:GPOConfiguration[$T]['Summary']) {
$Script:Reporting[$T]['Summary'] = Invoke-Command -ScriptBlock $Script:GPOConfiguration[$T]['Summary']
}
New-HTMLTab -Name $Script:GPOConfiguration[$T]['Name'] {
& $Script:GPOConfiguration[$T]['Solution']
}
}
}
}
} -Online:$Online.IsPresent -ShowHTML:(-not $HideHTML) -FilePath $FilePath
}
+61
View File
@@ -0,0 +1,61 @@
function New-HTMLReportWithSplit {
[cmdletBinding()]
param(
[string] $FilePath,
[switch] $Online,
[switch] $HideHTML,
[string] $CurrentReport
)
# Split reports into multiple files for easier viewing
$DateName = $(Get-Date -f yyyy-MM-dd_HHmmss)
$FileName = [io.path]::GetFileNameWithoutExtension($FilePath)
$DirectoryName = [io.path]::GetDirectoryName($FilePath)
foreach ($T in $Script:GPOConfiguration.Keys) {
$NewFileName = $FileName + '_' + $T + "_" + $DateName + '.html'
$FilePath = [io.path]::Combine($DirectoryName, $NewFileName)
# we execute only if enabled and current report not given which means there's a single report to run
# or if current report is given and it matches the current report type which works for split reprots
if ($Script:GPOConfiguration[$T].Enabled -eq $true -and ((-not $CurrentReport) -or ($CurrentReport -and $CurrentReport -eq $T))) {
Write-Color -Text '[i]', '[HTML ] ', "Generating HTML report ($FilePath) for $T with split reports" -Color Yellow, DarkGray, Yellow
New-HTML -Author 'Przemysław Kłys' -TitleText 'GPOZaurr Report' {
New-HTMLTabStyle -BorderRadius 0px -TextTransform capitalize -BackgroundColorActive SlateGrey
New-HTMLSectionStyle -BorderRadius 0px -HeaderBackGroundColor Grey -RemoveShadow
New-HTMLPanelStyle -BorderRadius 0px
New-HTMLTableOption -DataStore JavaScript -BoolAsString -ArrayJoinString ', ' -ArrayJoin
New-HTMLHeader {
New-HTMLSection -Invisible {
New-HTMLSection {
New-HTMLText -Text "Report generated on $(Get-Date)" -Color Blue
} -JustifyContent flex-start -Invisible
New-HTMLSection {
New-HTMLText -Text "GPOZaurr - $($Script:Reporting['Version'])" -Color Blue
} -JustifyContent flex-end -Invisible
}
}
# if ($Type.Count -eq 1) {
# foreach ($T in $Script:GPOConfiguration.Keys) {
# if ($Script:GPOConfiguration[$T].Enabled -eq $true) {
# if ($Script:GPOConfiguration[$T]['Summary']) {
# $Script:Reporting[$T]['Summary'] = Invoke-Command -ScriptBlock $Script:GPOConfiguration[$T]['Summary']
# }
# & $Script:GPOConfiguration[$T]['Solution']
# }
# }
# } else {
if ($Script:GPOConfiguration[$T]['Summary']) {
$Script:Reporting[$T]['Summary'] = Invoke-Command -ScriptBlock $Script:GPOConfiguration[$T]['Summary']
}
New-HTMLTab -Name $Script:GPOConfiguration[$T]['Name'] {
& $Script:GPOConfiguration[$T]['Solution']
}
# }
} -Online:$Online.IsPresent -ShowHTML:(-not $HideHTML) -FilePath $FilePath
}
}
}
+43
View File
@@ -0,0 +1,43 @@
function Export-GPOZaurrContent {
<#
.SYNOPSIS
Saves GPOs to XML or HTML files.
.DESCRIPTION
Saves GPOs to XML or HTML files.
.PARAMETER FolderOutput
The folder where the GPOs will be saved.
.PARAMETER ReportType
The type of report to generate. Valid values are XML or HTML. Default is XML.
.EXAMPLE
An example
.NOTES
General notes
#>
[CmdletBinding()]
param(
[Parameter(Mandatory)][alias('Path')][string] $FolderOutput,
[ValidateSet('XML', 'HTML')][string] $ReportType = 'XML'
)
if ($FolderOutput) {
if (-not (Test-Path -LiteralPath $FolderOutput)) {
$null = New-Item -Path $FolderOutput -ItemType Directory -Force
}
$Forest = Get-ADForest
$Count = 0
foreach ($Domain in $Forest.Domains) {
$GPOs = Get-GPO -All -Domain $Domain
foreach ($GPO in $GPOS) {
$Count++
Write-Verbose -Message "Export-GPOZaurr - Exporting ($Count / $($GPOs.Count)) - $($GPO.DisplayName) to $ReportTypeF"
$Name = "$($GPO.DomainName)_$($GPO.Id)_$($GPO.DisplayName).xml".Replace(" ", "_").Replace("|", "_")
$FullName = [io.path]::Combine($GPOOutput, $Name)
Get-GPOReport -Guid $GPO.Id -Domain $GPO.DomainName -ReportType $ReportType -Path $FullName
}
}
}
}
+6 -1
View File
@@ -68,7 +68,12 @@
DomainName = ConvertFrom-DistinguishedName -ToDomainCN -DistinguishedName $OU.DistinguishedName
}
if ($InheritanceInformation.BlockedInheritance -and $IncludeGroupPoliciesForBlockedObjects.IsPresent) {
$GPInheritance = Get-GPInheritance -Target $OU.distinguishedName
try {
$GPInheritance = Get-GPInheritance -Target $OU.distinguishedName -ErrorAction Stop
} catch {
Write-Warning -Message "Get-GPOZaurrInheritance - Can't get GPInheritance for $($OU.distinguishedName). Error: $($_.Exception.Message)"
continue
}
$ActiveGroupPolicies = foreach ($GPO in $GPInheritance.InheritedGpoLinks) {
[PSCustomObject] @{
OrganizationalUnit = $OU.canonicalName
+1 -1
View File
@@ -95,7 +95,7 @@
}
$Object['Owner'] = $_.Owner # : EVOTEC\Enterprise Admins
$Object['Path'] = $_.Path
$Object['SysVolPath '] = $SysvolPath
$Object['SysVolPath'] = $SysvolPath
$Object['Id '] = $_.Id # : 8a7bc515-d7fd-4d1f-90b8-e47c15f89295
$Object['GpoStatus'] = $_.GpoStatus # : AllSettingsEnabled
$Object['Description'] = $_.Description # :
+26 -44
View File
@@ -46,6 +46,9 @@
.PARAMETER Online
Forces report to use online resources in HTML (using CDN most of the time), by default it is run offline, and inlines all CSS/JS code.
.PARAMETER SplitReports
Split report into multiple files, one for each report. This can be useful for large domains with huge reports.
.EXAMPLE
Invoke-GPOZaurr
@@ -71,7 +74,8 @@
[alias('ForestName')][string] $Forest,
[string[]] $ExcludeDomains,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[switch] $Online
[switch] $Online,
[switch] $SplitReports
)
Reset-GPOZaurrStatus # This makes sure types are at it's proper status
@@ -181,56 +185,34 @@
$TimeEndGPOList = Stop-TimeLog -Time $TimeLogGPOList -Option OneLiner
$Script:Reporting[$T]['Time'] = $TimeEndGPOList
Write-Color -Text '[i]', '[End ] ', $($Script:GPOConfiguration[$T]['Name']), " [Time to execute: $TimeEndGPOList]" -Color Yellow, DarkGray, Yellow, DarkGray
if ($SplitReports) {
$TimeLogHTML = Start-TimeLog
New-HTMLReportWithSplit -FilePath $FilePath -Online:$Online -HideHTML:$HideHTML -CurrentReport $T
$TimeLogEndHTML = Stop-TimeLog -Time $TimeLogHTML -Option OneLiner
Write-Color -Text '[i]', '[HTML ] ', 'Generating HTML report', " [Time to execute: $TimeLogEndHTML]" -Color Yellow, DarkGray, Yellow, DarkGray
}
}
}
# Generate pretty HTML
$TimeLogHTML = Start-TimeLog
if (-not $FilePath) {
$FilePath = Get-FileName -Extension 'html' -Temporary
}
Write-Color -Text '[i]', '[HTML ] ', "Generating HTML report ($FilePath)" -Color Yellow, DarkGray, Yellow
New-HTML -Author 'Przemysław Kłys' -TitleText 'GPOZaurr Report' {
New-HTMLTabStyle -BorderRadius 0px -TextTransform capitalize -BackgroundColorActive SlateGrey
New-HTMLSectionStyle -BorderRadius 0px -HeaderBackGroundColor Grey -RemoveShadow
New-HTMLPanelStyle -BorderRadius 0px
New-HTMLTableOption -DataStore JavaScript -BoolAsString -ArrayJoinString ', ' -ArrayJoin
New-HTMLHeader {
New-HTMLSection -Invisible {
New-HTMLSection {
New-HTMLText -Text "Report generated on $(Get-Date)" -Color Blue
} -JustifyContent flex-start -Invisible
New-HTMLSection {
New-HTMLText -Text "GPOZaurr - $($Script:Reporting['Version'])" -Color Blue
} -JustifyContent flex-end -Invisible
}
if ( -not $SplitReports) {
# Generate pretty HTML
$TimeLogHTML = Start-TimeLog
if (-not $FilePath) {
$FilePath = Get-FileName -Extension 'html' -Temporary
}
if ($Type.Count -eq 1) {
foreach ($T in $Script:GPOConfiguration.Keys) {
if ($Script:GPOConfiguration[$T].Enabled -eq $true) {
if ($Script:GPOConfiguration[$T]['Summary']) {
$Script:Reporting[$T]['Summary'] = Invoke-Command -ScriptBlock $Script:GPOConfiguration[$T]['Summary']
}
& $Script:GPOConfiguration[$T]['Solution']
}
}
# Split reports are handled above so we skip if this was set
if ($Type.Count -gt 1) {
New-HTMLReportAll -FilePath $FilePath -Online:$Online -HideHTML:$HideHTML -Type $Type
} else {
foreach ($T in $Script:GPOConfiguration.Keys) {
if ($Script:GPOConfiguration[$T].Enabled -eq $true) {
if ($Script:GPOConfiguration[$T]['Summary']) {
$Script:Reporting[$T]['Summary'] = Invoke-Command -ScriptBlock $Script:GPOConfiguration[$T]['Summary']
}
New-HTMLTab -Name $Script:GPOConfiguration[$T]['Name'] {
& $Script:GPOConfiguration[$T]['Solution']
}
}
}
New-HTMLReportWithSplit -FilePath $FilePath -Online:$Online -HideHTML:$HideHTML
}
} -Online:$Online.IsPresent -ShowHTML:(-not $HideHTML) -FilePath $FilePath
$TimeLogEndHTML = Stop-TimeLog -Time $TimeLogHTML -Option OneLiner
Write-Color -Text '[i]', '[HTML ] ', 'Generating HTML report', " [Time to execute: $TimeLogEndHTML]" -Color Yellow, DarkGray, Yellow, DarkGray
$TimeLogEndHTML = Stop-TimeLog -Time $TimeLogHTML -Option OneLiner
Write-Color -Text '[i]', '[HTML ] ', 'Generating HTML report', " [Time to execute: $TimeLogEndHTML]" -Color Yellow, DarkGray, Yellow, DarkGray
}
if ($PassThru) {
$Script:Reporting
}