mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-07-26 20:00:09 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 65f52058d3 | |||
| 170896c0cc | |||
| cd72f79f85 | |||
| 8d32cb443e | |||
| 4f4fddddae | |||
| a374433922 | |||
| 96a5e0789e | |||
| f37887c8bf | |||
| 497438dc1e | |||
| 503b82ca02 | |||
| 790b3b97e0 | |||
| 07a8c77763 |
@@ -1,7 +1,5 @@
|
||||
Clear-Host
|
||||
|
||||
Import-Module "PSPublishModule" -Force
|
||||
|
||||
Invoke-ModuleBuild -ModuleName 'GPOZaurr' {
|
||||
# Usual defaults as per standard module
|
||||
$Manifest = @{
|
||||
|
||||
+26
-4
@@ -1,9 +1,31 @@
|
||||
# GPOZaurr Release History
|
||||
|
||||
## 1.1.6
|
||||
- Improve HTML reports with `ScrollX`
|
||||
- Improve HTML reports by hiding some unnesecary columns
|
||||
- Added `SizeMB` and `Size` to reports around files/GPOs which could help analyze performance issues
|
||||
## 1.1.8 - 2024.11.20
|
||||
### What's new
|
||||
- Added `RestrictedGroups` to GroupAnalysis
|
||||
|
||||
**Full Changelog**: https://github.com/EvotecIT/GPOZaurr/compare/v1.1.7...v1.1.8
|
||||
|
||||
## 1.1.7 - 2024.11.20
|
||||
### What's Changed
|
||||
- Added some additional logging to track down issue
|
||||
|
||||
## 1.1.6 - 2024.10.17
|
||||
### What's Changed
|
||||
* Improve HTML reports with `ScrollX`
|
||||
* Improve HTML reports by hiding some unnesecary columns
|
||||
* Added `SizeMB` and `Size` to reports around files/GPOs which could help analyze performance issues
|
||||
* Other minor HTML fixes
|
||||
* Fixed typo "Unfortunetly" -> "Unfortunately" by @davidmwilliams in https://github.com/EvotecIT/GPOZaurr/pull/61
|
||||
* Minor typo correction "incosistent" -> "inconsistent" by @davidmwilliams in https://github.com/EvotecIT/GPOZaurr/pull/60
|
||||
* Update Invoke.GPOZaurrDuplicate.ps1 by @SamErde in https://github.com/EvotecIT/GPOZaurr/pull/63
|
||||
* Fix typo and grammar by @SamErde in https://github.com/EvotecIT/GPOZaurr/pull/64
|
||||
|
||||
### New Contributors
|
||||
* @davidmwilliams made their first contribution in https://github.com/EvotecIT/GPOZaurr/pull/61
|
||||
* @SamErde made their first contribution in https://github.com/EvotecIT/GPOZaurr/pull/63
|
||||
|
||||
**Full Changelog**: https://github.com/EvotecIT/GPOZaurr/compare/v1.1.5...v1.1.6
|
||||
|
||||
## 1.1.5 - 2024.07.06
|
||||
* Added or improved help on all functions. by @neztach in https://github.com/EvotecIT/GPOZaurr/pull/56
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
|
||||
|
||||
|
||||
#$O = Invoke-GPOZaurrContent -GPOName "Test-RestrictedGroups" -Verbose
|
||||
#$O
|
||||
|
||||
Invoke-GPOZaurr -Online -Type GPOBroken, GPOBrokenLink -Verbose -SplitReports
|
||||
|
||||
return
|
||||
|
||||
#$Output = Invoke-GPOZaurrContent -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPODefender'
|
||||
$Output = Invoke-GPOZaurrContent -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExport' -Type WindowsHelloForBusiness
|
||||
$Output | Format-Table
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
|
||||
|
||||
$Files = Get-GPOZaurrFiles -Limited -Signature
|
||||
$Files | ConvertTo-Excel -OpenWorkBook -FilePath $Env:USERPROFILE\Desktop\GPOTesting.xlsx -ExcelWorkSheetName 'GPO Output' -AutoFilter -AutoFit -FreezeTopRowFirstColumn
|
||||
$Files = Get-GPOZaurrFiles -Type All -Verbose
|
||||
#$Files | ConvertTo-Excel -OpenWorkBook -FilePath $Env:USERPROFILE\Desktop\GPOTesting.xlsx -ExcelWorkSheetName 'GPO Output' -AutoFilter -AutoFit -FreezeTopRowFirstColumn
|
||||
$Files | Format-Table
|
||||
@@ -27,4 +27,4 @@
|
||||
#Invoke-GPOZaurr -Online -FilePath $PSScriptRoot\Reports\GPOZaurr.html -Type GPOAnalysis #-SplitReports -Forest test.evotec.pl
|
||||
|
||||
|
||||
Invoke-GPOZaurr -FilePath $PSScriptRoot\Reports\GPOZaurr.html -Type GPOBlockedInheritance -Forest 'ad.evotec.xyz'
|
||||
Invoke-GPOZaurr -FilePath $PSScriptRoot\Reports\GPOZaurr.html # -Verbose #-Type GPOBlockedInheritance -Forest 'ad.evotec.xyz'
|
||||
@@ -3,6 +3,8 @@
|
||||
$OUs = Get-GPOZaurrOrganizationalUnit
|
||||
$Ous | Format-Table
|
||||
|
||||
return
|
||||
|
||||
Get-GPOZaurrOrganizationalUnit -Verbose -Option Unlink -Exclusions @(
|
||||
'OU=Groups,OU=Production,DC=ad,DC=evotec,DC=pl'
|
||||
) | Format-Table
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
Import-Module .\GPOZaurr.psd1 -Force
|
||||
|
||||
$DirectoryPath = "C:\Support\GitHub\GpoZaurr\Data\ADMXTemplates"
|
||||
$Paths = @(
|
||||
[PSCustomObject] @{ Name = "Citrix"; Path = "C:\Program Files (x86)\Citrix\ICA Client\Configuration"; ExportFile = "Citrix" }
|
||||
[PSCustomObject] @{ Name = "Remote Desktop Manager"; Path = "C:\Program Files\Devolutions\Remote Desktop Manager\Policies" ; ExportFile = "Remote Desktop Manager" }
|
||||
[PSCustomObject] @{ Name = "Microsoft Windows 2022 Security Baseline"; Path = "C:\Users\przemyslaw.klys\Downloads\GPO\Windows Server 2022 Security Baseline\Windows Server-2022-Security-Baseline-FINAL\Templates" ; ExportFile = "Windows Server 2022 Security Baseline" }
|
||||
[PSCustomObject] @{ Name = "Microsoft OneDrive"; Path = "C:\Program Files\Microsoft OneDrive\24.216.1027.0003\adm" ; ExportFile = "Microsoft OneDrive" }
|
||||
[PSCustomObject] @{ Name = "Microsoft PowerShell 7 Core"; Path = "C:\Program Files\PowerShell\7" ; ExportFile = "Microsoft PowerShell 7" }
|
||||
[PSCustomObject] @{ Name = "Microsoft Windows 11 (24H2) September 2024"; Path = "C:\Program Files (x86)\Microsoft Group Policy\Windows 11 Sep 2024 Update (24H2)" ; ExportFile = "Microsoft Windows11 24H2 September 2024" }
|
||||
)
|
||||
foreach ($Path in $Paths) {
|
||||
$InitializeGPOZaurrTemplateSplat = @{
|
||||
Path = $Path.Path
|
||||
Name = $Path.Name
|
||||
ExportPath = "$DirectoryPath\$($Path.ExportFile).json"
|
||||
}
|
||||
$List = Initialize-GPOZaurrTemplate @InitializeGPOZaurrTemplateSplat -Verbose
|
||||
}
|
||||
+4
-4
@@ -6,9 +6,9 @@
|
||||
CompatiblePSEditions = @('Desktop')
|
||||
Copyright = '(c) 2011 - 2024 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', '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-GPOZaurrMissingFiles', 'Get-GPOZaurrNetLogon', 'Get-GPOZaurrOrganizationalUnit', 'Get-GPOZaurrOwner', 'Get-GPOZaurrPassword', 'Get-GPOZaurrPermission', 'Get-GPOZaurrPermissionAnalysis', 'Get-GPOZaurrPermissionConsistency', 'Get-GPOZaurrPermissionIssue', 'Get-GPOZaurrPermissionRoot', 'Get-GPOZaurrPermissionSummary', 'Get-GPOZaurrRedirect', '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-GPOZaurrTemplates', '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-GPOZaurrMissingFiles', 'Get-GPOZaurrNetLogon', 'Get-GPOZaurrOrganizationalUnit', 'Get-GPOZaurrOwner', 'Get-GPOZaurrPassword', 'Get-GPOZaurrPermission', 'Get-GPOZaurrPermissionAnalysis', 'Get-GPOZaurrPermissionConsistency', 'Get-GPOZaurrPermissionIssue', 'Get-GPOZaurrPermissionRoot', 'Get-GPOZaurrPermissionSummary', 'Get-GPOZaurrRedirect', 'Get-GPOZaurrSysvolDFSR', 'Get-GPOZaurrUpdates', 'Get-GPOZaurrWMI', 'Initialize-GPOZaurrTemplate', '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 = '1.1.6'
|
||||
ModuleVersion = '1.1.9'
|
||||
PowerShellVersion = '5.1'
|
||||
PrivateData = @{
|
||||
PSData = @{
|
||||
@@ -24,11 +24,11 @@
|
||||
}, @{
|
||||
Guid = 'ee272aa8-baaa-4edf-9f45-b6d6f7d844fe'
|
||||
ModuleName = 'PSSharedGoods'
|
||||
ModuleVersion = '0.0.297'
|
||||
ModuleVersion = '0.0.300'
|
||||
}, @{
|
||||
Guid = '9fc9fd61-7f11-4f4b-a527-084086f1905f'
|
||||
ModuleName = 'ADEssentials'
|
||||
ModuleVersion = '0.0.221'
|
||||
ModuleVersion = '0.0.226'
|
||||
}, @{
|
||||
Guid = 'a7bdf640-f5cb-4acf-9de0-365b322d245c'
|
||||
ModuleName = 'PSWriteHTML'
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
function ConvertTo-XMLRestrictedGroups {
|
||||
[cmdletBinding()]
|
||||
param(
|
||||
[PSCustomObject] $GPO,
|
||||
[switch] $SingleObject
|
||||
)
|
||||
if ($SingleObject) {
|
||||
$CreateGPO = [ordered]@{
|
||||
DisplayName = $GPO.DisplayName
|
||||
DomainName = $GPO.DomainName
|
||||
GUID = $GPO.GUID
|
||||
GpoType = $GPO.GpoType
|
||||
#GpoCategory = $GPOEntry.GpoCategory
|
||||
#GpoSettings = $GPOEntry.GpoSettings
|
||||
Count = 0
|
||||
Settings = $null
|
||||
}
|
||||
[Array] $CreateGPO['Settings'] = foreach ($Script in $GPO.DataSet) {
|
||||
$Members = foreach ($Member in $Group.Member) {
|
||||
if ($($Member.SID.'#text')) {
|
||||
"$($Member.Name.'#text') ($($Member.SID.'#text'))"
|
||||
} else {
|
||||
$Member.Name.'#text'
|
||||
}
|
||||
}
|
||||
$MemberOf = foreach ($Member in $Group.MemberOf) {
|
||||
if ($($Member.SID.'#text')) {
|
||||
"$($Member.Name.'#text') ($($Member.SID.'#text'))"
|
||||
} else {
|
||||
$Member.Name.'#text'
|
||||
}
|
||||
}
|
||||
[PSCustomObject]@{
|
||||
GroupName = $Group.GroupName.Name
|
||||
GroupSID = $Group.GroupName.SID.'#text'
|
||||
Members = $Members -join ', '
|
||||
MembersOf = $MemberOf -join ', '
|
||||
}
|
||||
}
|
||||
$CreateGPO['DataCount'] = $CreateGPO['Settings'].Count
|
||||
$CreateGPO['Linked'] = $GPO.Linked
|
||||
$CreateGPO['LinksCount'] = $GPO.LinksCount
|
||||
$CreateGPO['Links'] = $GPO.Links
|
||||
[PSCustomObject] $CreateGPO
|
||||
} else {
|
||||
foreach ($Group in $GPO.DataSet) {
|
||||
$Members = foreach ($Member in $Group.Member) {
|
||||
if ($($Member.SID.'#text')) {
|
||||
"$($Member.Name.'#text') ($($Member.SID.'#text'))"
|
||||
} else {
|
||||
$Member.Name.'#text'
|
||||
}
|
||||
}
|
||||
$MemberOf = foreach ($Member in $Group.MemberOf) {
|
||||
if ($($Member.SID.'#text')) {
|
||||
"$($Member.Name.'#text') ($($Member.SID.'#text'))"
|
||||
} else {
|
||||
$Member.Name.'#text'
|
||||
}
|
||||
}
|
||||
$CreateGPO = [ordered]@{
|
||||
DisplayName = $GPO.DisplayName
|
||||
DomainName = $GPO.DomainName
|
||||
GUID = $GPO.GUID
|
||||
GpoType = $GPO.GpoType
|
||||
GroupName = $Group.GroupName.Name.'#text'
|
||||
GroupSID = $Group.GroupName.SID.'#text'
|
||||
Members = $Members -join ', '
|
||||
MembersOf = $MemberOf -join ', '
|
||||
}
|
||||
$CreateGPO['Linked'] = $GPO.Linked
|
||||
$CreateGPO['LinksCount'] = $GPO.LinksCount
|
||||
$CreateGPO['Links'] = $GPO.Links
|
||||
[PSCustomObject] $CreateGPO
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,7 +380,7 @@
|
||||
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'FSLogix' -SingleObject
|
||||
}
|
||||
}
|
||||
Firefox = @{
|
||||
Firefox = @{
|
||||
Types = @(
|
||||
@{
|
||||
Category = 'RegistrySettings'
|
||||
@@ -974,6 +974,21 @@
|
||||
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Remote Desktop Services*' -SingleObject
|
||||
}
|
||||
}
|
||||
RestrictedGroups = @{
|
||||
Types = @(
|
||||
@{
|
||||
Category = 'SecuritySettings'
|
||||
Settings = 'RestrictedGroups'
|
||||
}
|
||||
)
|
||||
GPOPath = 'Policies -> Windows Settings -> Security Settings -> Restricted Groups'
|
||||
Code = {
|
||||
ConvertTo-XMLRestrictedGroups -GPO $GPO
|
||||
}
|
||||
CodeSingle = {
|
||||
ConvertTo-XMLRestrictedGroups -GPO $GPO -SingleObject
|
||||
}
|
||||
}
|
||||
RSSFeeds = @{
|
||||
Types = @(
|
||||
@{
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
function Get-GPOZaurrTemplates {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
|
||||
)
|
||||
|
||||
|
||||
$SysvolADMXPath = "\\$env:USERDNSDOMAIN\SYSVOL\$env:USERDNSDOMAIN\Policies\PolicyDefinitions"
|
||||
Get-ChildItem -Path $SysvolADMXPath -Filter "*.admx" -Recurse -File | ForEach-Object {
|
||||
[PSCustomObject]@{
|
||||
Name = $_.Name
|
||||
Path = $_.FullName
|
||||
Size = $_.Length
|
||||
LastWriteTime = $_.LastWriteTime
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
foreach ($Domain in $ForestInformation.Domains) {
|
||||
Write-Verbose "Get-GPOZaurrOrganizationalUnit - Processing $($Domain)"
|
||||
$CountTop = 0
|
||||
$TopOrganizationalUnits = Get-ADOrganizationalUnit -Filter * -Properties LinkedGroupPolicyObjects, DistinguishedName, ntSecurityDescriptor -Server $ForestInformation['QueryServers'][$Domain]['hostname'][0] -SearchScope OneLevel
|
||||
[Array] $TopOrganizationalUnits = Get-ADOrganizationalUnit -Filter * -Properties LinkedGroupPolicyObjects, DistinguishedName, ntSecurityDescriptor -Server $ForestInformation['QueryServers'][$Domain]['hostname'][0] -SearchScope OneLevel
|
||||
foreach ($TopOU in $TopOrganizationalUnits) {
|
||||
$CountTop++
|
||||
Write-Verbose "Get-GPOZaurrOrganizationalUnit - Processing $($Domain) / $($TOPOU.DistinguishedName) [$CountTop/$($TopOrganizationalUnits.Count)]"
|
||||
@@ -75,7 +75,7 @@
|
||||
}
|
||||
|
||||
# cache children OUs
|
||||
$OUs = Get-ADOrganizationalUnit -SearchScope Subtree -SearchBase $TopOU.DistinguishedName -Server $ForestInformation['QueryServers'][$Domain]['hostname'][0] -Properties LinkedGroupPolicyObjects, DistinguishedName -Filter *
|
||||
[Array] $OUs = Get-ADOrganizationalUnit -SearchScope Subtree -SearchBase $TopOU.DistinguishedName -Server $ForestInformation['QueryServers'][$Domain]['hostname'][0] -Properties LinkedGroupPolicyObjects, DistinguishedName -Filter *
|
||||
Write-Verbose "Get-GPOZaurrOrganizationalUnit - Processing $($Domain) / $($TOPOU.DistinguishedName) [$CountTop/$($TopOrganizationalUnits.Count)], found $($OUs.Count) OU's to process."
|
||||
foreach ($OU in $OUs) {
|
||||
if (-not $CachedOu[$OU.DistinguishedName]) {
|
||||
@@ -103,8 +103,13 @@
|
||||
Write-Verbose "Get-GPOZaurrOrganizationalUnit - Processing $($Domain) / $($TOPOU.DistinguishedName) [$CountTop/$($TopOrganizationalUnits.Count)], found $($ObjectsInOu.Count) objects to process."
|
||||
foreach ($Object in $ObjectsInOu) {
|
||||
$Place = ConvertFrom-DistinguishedName -ToOrganizationalUnit -DistinguishedName $Object.DistinguishedName
|
||||
$AllOUs = ConvertFrom-DistinguishedName -ToMultipleOrganizationalUnit -IncludeParent -DistinguishedName $Place
|
||||
[Array] $AllOUs = ConvertFrom-DistinguishedName -ToMultipleOrganizationalUnit -IncludeParent -DistinguishedName $Place
|
||||
foreach ($OU in $AllOUs) {
|
||||
if (-not $CachedOu[$OU]) {
|
||||
Write-Warning "Get-GPOZaurrOrganizationalUnit - Object $($Object.DistinguishedName) is in OU $($OU) but it's not in cache. This should not happen. Please report this issue."
|
||||
Write-Warning "Get-GPOZaurrOrganizationalUnit - Debug information: Place: $($Place), AllOUs: $($AllOUs.Count)"
|
||||
continue
|
||||
}
|
||||
if ($OU -eq $Place) {
|
||||
$CachedOu[$OU]['Objects'][$Object.DistinguishedName] = $Object
|
||||
$CachedOu[$OU]['ObjectsClasses'][$Object.ObjectClass] = ''
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
function Initialize-GPOZaurrTemplate {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)][string] $Name,
|
||||
[Parameter(Mandatory)][string] $Path,
|
||||
[string] $ExportPath
|
||||
)
|
||||
|
||||
$Files = Get-ChildItem -Path $Path -Filter "*.admx" -Recurse -File
|
||||
$TotalFiles = $Files.Count
|
||||
$ProgressIncrement = [math]::Ceiling($TotalFiles / 10)
|
||||
$CurrentProgress = 0
|
||||
|
||||
$FullList = foreach ($File in $Files) {
|
||||
$CurrentProgress++
|
||||
if ($CurrentProgress % $ProgressIncrement -eq 0) {
|
||||
Write-Verbose ("Initialize-GPOZaurrTemplate - Processing $Name, template file {0} of {1} ({2}%)" -f $CurrentProgress, $TotalFiles, [math]::Round(($CurrentProgress / $TotalFiles) * 100))
|
||||
}
|
||||
$HashInformation = Get-FileHash -LiteralPath $File.FullName
|
||||
$Directories = Get-ChildItem -Path $File.DirectoryName -Directory
|
||||
$Languages = [ordered] @{}
|
||||
foreach ($Directory in $Directories) {
|
||||
$LanguageFile = [io.path]::Combine($Directory.FullName, $File.BaseName + ".adml")
|
||||
$Item = Get-Item -Path $LanguageFile -ErrorAction SilentlyContinue
|
||||
if (Test-Path -Path $LanguageFile) {
|
||||
$HashInformation = Get-FileHash -LiteralPath $LanguageFile
|
||||
$Languages[$Directory.Name] = [PSCustomObject]@{
|
||||
Name = $Directory.Name
|
||||
Hash = $HashInformation.Hash
|
||||
Algorithm = $HashInformation.Algorithm
|
||||
Size = $Item.Length
|
||||
CreationTimeUtc = $Item.CreationTimeUtc
|
||||
LastWriteTimeUtc = $Item.LastWriteTimeUtc
|
||||
}
|
||||
}
|
||||
}
|
||||
[PSCustomObject] @{
|
||||
Name = $File.Name
|
||||
Hash = $HashInformation.Hash
|
||||
Algorithm = $HashInformation.Algorithm
|
||||
Size = $File.Length
|
||||
LanguagesAvailable = $Languages.Keys
|
||||
LanguagesCount = $Languages.Keys.Count
|
||||
CreationTimeUtc = $File.CreationTimeUtc
|
||||
LastWriteTimeUtc = $File.LastWriteTimeUtc
|
||||
LanguageFile = $Languages
|
||||
}
|
||||
}
|
||||
|
||||
$OutputObject = [PSCustomObject] @{
|
||||
Name = $Name
|
||||
Path = $Path
|
||||
Templates = $FullList
|
||||
}
|
||||
if ($ExportPath) {
|
||||
if ($ExportPath.EndsWith('.xml')) {
|
||||
$ExportType = 'XML'
|
||||
} elseif ($ExportPath.EndsWith('.json')) {
|
||||
$ExportType = 'JSON'
|
||||
} else {
|
||||
$ExportType = 'XML'
|
||||
}
|
||||
if ($ExportType -eq 'XML') {
|
||||
$OutputObject | Export-Clixml -Path $ExportPath -ErrorAction Stop
|
||||
} elseif ($ExportType -eq 'JSON') {
|
||||
$OutputObject | ConvertTo-Json -Depth 10 | Set-Content -Path $ExportPath -ErrorAction Stop
|
||||
} else {
|
||||
Write-Warning "ExportType $ExportType is not supported. Exporting to XML."
|
||||
}
|
||||
}
|
||||
$OutputObject
|
||||
}
|
||||
@@ -156,13 +156,17 @@
|
||||
Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation -GPOName $Name
|
||||
}
|
||||
foreach ($GUID in $GPOGUID) {
|
||||
Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation -GPOGUID $GUID
|
||||
Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation -GPOGuid $GUID
|
||||
}
|
||||
)
|
||||
} else {
|
||||
Write-Verbose "Invoke-GPOZaurrContent - Query AD for GPOs"
|
||||
[Array] $GPOs = Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
|
||||
}
|
||||
if ($GPOs.Count -eq 0) {
|
||||
Write-Warning "Invoke-GPOZaurrContent - No GPOs found. Exiting."
|
||||
return
|
||||
}
|
||||
# This caches single reports.
|
||||
$TemporaryCachedSingleReports = [ordered] @{}
|
||||
$TemporaryCachedSingleReports['ReportsSingle'] = [ordered] @{}
|
||||
@@ -171,7 +175,7 @@
|
||||
$Output['Reports'] = [ordered] @{}
|
||||
$Output['CategoriesFull'] = [ordered] @{}
|
||||
|
||||
$ForestInformation = Get-WinADForestDetails -PreferWritable -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
|
||||
$ForestInformation = Get-WinADForestDetails -PreferWritable -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
|
||||
|
||||
Write-Verbose "Invoke-GPOZaurrContent - Loading GPO Report to Categories"
|
||||
$CountGPO = 0
|
||||
|
||||
Reference in New Issue
Block a user