Compare commits

...

90 Commits

Author SHA1 Message Date
Przemyslaw Klys fc9b191578 Update 2020-08-17 13:12:00 +02:00
Przemyslaw Klys 04e5eaf63c Fix for Inheritance 2020-08-17 13:11:18 +02:00
Przemyslaw Klys 494b1582ca Update 2020-08-17 10:00:47 +02:00
Przemyslaw Klys c33b820e36 Update 2020-08-16 22:28:08 +02:00
Przemyslaw Klys cfeb0098a6 Update 2020-08-16 22:17:08 +02:00
Przemyslaw Klys e2bba32a57 Update 2020-08-15 11:22:37 +02:00
Przemyslaw Klys 1ca6673ee4 Update RSOP 2020-08-15 11:20:31 +02:00
Przemyslaw Klys cb9326e8b6 Update README/PSD1 2020-08-15 11:20:18 +02:00
Przemyslaw Klys 10be16ad53 Reports updated 2020-08-15 11:20:05 +02:00
Przemyslaw Klys 0c26642a72 Update example 2020-08-14 23:00:54 +02:00
Przemyslaw Klys 5d76f9125d Fixes to Invoke-GPOZaurr 2020-08-14 22:56:15 +02:00
Przemyslaw Klys 5b930f4536 Added Get-GPOZaurInheritance 2020-08-14 22:56:02 +02:00
Przemyslaw Klys b118000672 Update PSD1, README 2020-08-14 22:55:33 +02:00
Przemyslaw Klys 603de5a42e Update 2020-08-13 22:02:48 +02:00
Przemyslaw Klys 9fe0157293 Update 2020-08-13 13:34:03 +02:00
Przemyslaw Klys b3d5df8188 Update 2020-08-13 13:33:38 +02:00
Przemyslaw Klys 00ce6f42d7 Update 2020-08-13 10:17:47 +02:00
Przemyslaw Klys ec30c54577 Update CSE 2020-08-13 09:40:35 +02:00
Przemyslaw Klys 1974eb2a39 Update 2020-08-13 09:04:17 +02:00
Przemyslaw Klys 03a09809ab Update 2020-08-13 00:04:11 +02:00
Przemyslaw Klys 825f9fda42 Update 2020-08-13 00:01:19 +02:00
Przemyslaw Klys a41fb8473b Update 2020-08-11 16:56:43 +02:00
Przemyslaw Klys d2f02e46e0 Update 2020-08-09 23:54:08 +02:00
Przemyslaw Klys dcff4516b4 Update 2020-08-09 22:37:40 +02:00
Przemyslaw Klys 651ee3f6c9 Update 2020-08-09 22:37:35 +02:00
Przemyslaw Klys 7aefc6047b Update 2020-08-09 22:37:28 +02:00
Przemyslaw Klys 2bca54fd06 Add Invoke-GPOZaurrSupport (WIP) 2020-08-09 22:36:53 +02:00
Przemyslaw Klys 3fd8872e5c WIP 2020-08-05 13:59:48 +02:00
Przemyslaw Klys 57efc58c2f Updated examples 2020-08-05 13:59:04 +02:00
Przemyslaw Klys 40e422682b New command Get-GPOZaurrDictionary 2020-08-05 13:58:56 +02:00
Przemyslaw Klys d2b9fc0960 Updated XMLGenericPolicy 2020-08-05 13:58:45 +02:00
Przemyslaw Klys f8fdf1ff98 Updated dictionary 2020-08-05 13:58:25 +02:00
Przemyslaw Klys 1d198dbd7c Fix for AUtologon 2020-08-05 13:58:18 +02:00
Przemyslaw Klys 2dd780910a Update PSD1 2020-08-05 13:58:03 +02:00
Przemyslaw Klys ed22b56716 Missing disabled property for registry 2020-08-05 12:44:14 +02:00
Przemyslaw Klys 7bcef67820 Added InternetExplorerZones 2020-08-05 12:44:03 +02:00
Przemyslaw Klys 1941577b24 Update DFSR 2020-08-02 16:54:16 +02:00
Przemyslaw Klys 97a189eda5 Added Example for cleanup dfsr 2020-08-02 14:01:28 +02:00
Przemyslaw Klys 0759d1cb85 Update readme 2020-08-02 14:01:18 +02:00
Przemyslaw Klys 424e9d2f5c Update PSD1 2020-08-02 14:01:11 +02:00
Przemyslaw Klys 794f6997b8 Some updates to Get-GPOZaurrSysvolDFSR 2020-08-02 14:01:05 +02:00
Przemyslaw Klys 175b6dede2 added Clear-GPOZaurrSysvolDFSR 2020-08-02 14:00:49 +02:00
Przemyslaw Klys 91bace0a05 Added Get-GPOZaurrSysvolDFSR 2020-08-02 13:46:36 +02:00
Przemyslaw Klys 7d829ac78d Update Example 2020-08-02 00:54:28 +02:00
Przemyslaw Klys caa9585906 removed dead code 2020-08-02 00:50:41 +02:00
Przemyslaw Klys d0d6427b38 removed dead code 2020-08-02 00:50:32 +02:00
Przemyslaw Klys 7c5622f682 Removed dead code 2020-08-02 00:50:25 +02:00
Przemyslaw Klys 12e183b45c Removed dead code 2020-08-02 00:50:11 +02:00
Przemyslaw Klys e52dc71857 Update PSD1 2020-08-02 00:50:02 +02:00
Przemyslaw Klys 9041f4cdbc Removed dead code 2020-08-02 00:43:43 +02:00
Przemyslaw Klys 6f503f735f Why was it even here? 2020-08-02 00:43:36 +02:00
Przemyslaw Klys 27830e9f8a Removing dead code 2020-08-02 00:41:43 +02:00
Przemyslaw Klys d8c63ce949 Uploading just to have backup 2020-08-02 00:41:21 +02:00
Przemyslaw Klys 33b2854d63 Cleaning up dead code 2020-08-02 00:41:05 +02:00
Przemyslaw Klys acb51d4444 Update Invoke-GPOZaurr 2020-08-02 00:32:30 +02:00
Przemyslaw Klys 3bc9bb5f9c A lot more policy types supported 2020-08-02 00:32:18 +02:00
Przemyslaw Klys 58d94edac0 Great policy, with update for ListBox 2020-08-02 00:32:04 +02:00
Przemyslaw Klys d76ae5cd1d Lithnet update, but most likely to remove 2020-08-02 00:31:52 +02:00
Przemyslaw Klys a11d563704 Bitlocker update, but most likely to remove 2020-08-02 00:31:41 +02:00
Przemyslaw Klys 34c55c8482 Example update 2020-08-02 00:31:20 +02:00
Przemyslaw Klys c6fdfccc61 Update PSD1 2020-08-02 00:31:10 +02:00
Przemyslaw Klys e512c0b0de Update - but maybe we should remove this 2020-08-01 00:12:03 +02:00
Przemyslaw Klys 7afd104b7b Update psd1 2020-07-31 15:26:56 +02:00
Przemyslaw Klys 60511fa602 Removed dead examples 2020-07-31 15:26:48 +02:00
Przemyslaw Klys 9b3924cc00 Added Lithnet filter 2020-07-31 15:24:03 +02:00
Przemyslaw Klys 0bf093351f Added LAPS support 2020-07-31 11:00:57 +02:00
Przemyslaw Klys 2d164750f1 Update 2020-07-30 22:56:17 +02:00
Przemyslaw Klys b8d440f547 Better audit report 2020-07-30 22:56:09 +02:00
Przemyslaw Klys f25ace130c Audit update to to advanced events 2020-07-30 22:55:58 +02:00
Przemyslaw Klys 8b17f9e3a2 Updated policies to use int instead of strings 2020-07-30 22:55:01 +02:00
Przemyslaw Klys b97cf1fd9d Update 2020-07-30 22:04:13 +02:00
Przemyslaw Klys 416b3f0273 Update 2020-07-30 22:03:51 +02:00
Przemyslaw Klys d3c31e9651 Update example 2020-07-30 21:58:41 +02:00
Przemyslaw Klys 8b963c6b82 Rewritten Autologon using Reports on Reports 2020-07-30 21:58:28 +02:00
Przemyslaw Klys 989d3ba9f0 Added functionality reports based on reports 2020-07-30 21:58:15 +02:00
Przemyslaw Klys f3e2d3cc11 Removed verbose messages 2020-07-30 21:57:54 +02:00
Przemyslaw Klys a7b8b5f6ea Update 2020-07-30 13:41:58 +02:00
Przemyslaw Klys 7f2adbbb13 Update 2020-07-30 12:23:52 +02:00
Przemyslaw Klys a82e460406 Update 2020-07-30 12:23:38 +02:00
Przemyslaw Klys a0e990bf2a Update to example 2020-07-30 11:28:56 +02:00
Przemyslaw Klys ddc5630244 Small update 2020-07-30 11:28:47 +02:00
Przemyslaw Klys d377e92fb5 Fixed reading Registry XML 2020-07-30 11:26:47 +02:00
Przemyslaw Klys b8c3f1e8f8 Updates to Printer XML 2020-07-30 11:26:37 +02:00
Przemyslaw Klys a827afab39 Fix for argument completer 2020-07-29 23:20:27 +02:00
Przemyslaw Klys 61bb568c94 Fix for nested XML, still collection name is wrong 2020-07-29 23:20:07 +02:00
Przemyslaw Klys 3f4d8c9907 Better assesment of empty and linked gpos 2020-07-29 22:13:11 +02:00
Przemyslaw Klys f6466c2ca7 Update PSD1 2020-07-29 22:12:36 +02:00
Przemyslaw Klys 609d93118b Fix for lack of value 2020-07-29 22:12:30 +02:00
Przemyslaw Klys 193ddd6ff9 Update 2020-07-29 14:36:17 +02:00
Przemyslaw Klys 889ce5f9ab Update 2020-07-23 12:31:18 +02:00
66 changed files with 2700 additions and 929 deletions
@@ -2,4 +2,4 @@
# Remove GPOS
$BackupPath = "$Env:UserProfile\Desktop\GPO"
Remove-GPOZaurr -Type Empty, Unlinked -BackupPath $BackupPath -BackupDated -LimitProcessing 2 -Verbose
Remove-GPOZaurr -Type Empty, Unlinked -BackupPath $BackupPath -BackupDated -LimitProcessing 2 -Verbose -WhatIf
+1 -1
View File
@@ -1,7 +1,7 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
$GPOS = Get-GPOZaurr
$GPOS | Format-Table -AutoSize
$GPOS | Format-Table -AutoSize *
$GPOS[0] | Format-List
+1 -1
View File
@@ -1,3 +1,3 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
Remove-GPOZaurrLegacyFiles -Verbose -BackupPath $Env:USERPROFILE\Desktop\BackupADM -BackupDated -RemoveEmptyFolders #-WhatIf #-LimitProcessing 2 -WhatIf
Remove-GPOZaurrLegacyFiles -Verbose -BackupPath $Env:USERPROFILE\Desktop\BackupADM1 -BackupDated -RemoveEmptyFolders -WhatIf -LimitProcessing 2
-10
View File
@@ -1,10 +0,0 @@
Clear-Host
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
$Output = Get-GPOZaurrSysvol | ForEach-Object {
$Path = $_.Path
Get-ChildItem -Path $Path -ErrorAction SilentlyContinue -Recurse -ErrorVariable err -File | ForEach-Object {
Get-FileMetaData -File $_ -Signature -HashAlgorithm 'SHA256'
}
}
$Output | Format-Table
@@ -0,0 +1,6 @@
Clear-Host
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
$Dictionary = Get-GPOZaurrDictionary #-Splitter '; '
$Dictionary | Format-Table
$Dictionary | Out-HtmlView
+1 -1
View File
@@ -1,4 +1,4 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
#Save-GPOZaurrFiles -GPOPath $ENV:USERPROFILE\Desktop\GPOExport -DeleteExisting
Save-GPOZaurrFiles -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExport' #-DeleteExisting
Save-GPOZaurrFiles -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportEvotec' #-DeleteExisting
@@ -1,34 +0,0 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# Use Save-GPOZaurrFiles -GPOPath $ENV:USERPROFILE\Desktop\GPOExport
#$OutputNoTranslation = Invoke-GPOZaurr -GPOPath $Env:UserProfile\Desktop\GPOExport -NoTranslation
#$OutputNoTranslation = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -NoTranslation
$OutputNoTranslation | Format-Table *
<#
New-HTML {
foreach ($GPOCategory in $OutputNoTranslation.Keys) {
New-HTMLTab -Name $GPOCategory {
if ($OutputNoTranslation["$GPOCategory"] -is [System.Collections.IDictionary]) {
foreach ($GpoSettings in $OutputNoTranslation["$GPOCategory"].Keys) {
New-HTMLTab -Name $GpoSettings {
New-HTMLTable -DataTable $OutputNoTranslation[$GPOCategory][$GpoSettings] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
}
}
} else {
New-HTMLTable -DataTable $OutputNoTranslation[$GPOCategory] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
}
}
}
} -Online -ShowHTML -FilePath $Env:UserProfile\Desktop\OutputFromFindGPO-NoTranslationFromDisk.html
#>
foreach ($GPOCategory in $OutputNoTranslation.Keys) {
if ($OutputNoTranslation["$GPOCategory"] -is [System.Collections.IDictionary]) {
foreach ($GpoSettings in $OutputNoTranslation["$GPOCategory"].Keys) {
ConvertTo-Excel -DataTable $OutputNoTranslation[$GPOCategory][$GpoSettings] -AllProperties -ExcelWorkSheetName $GpoSettings -FilePath $Env:UserProfile\Desktop\Export\$GpoSettings.xlsx -AutoFilter -AutoFit
}
} else {
ConvertTo-Excel -DataTable $OutputNoTranslation[$GPOCategory][$GpoSettings] -AllProperties -ExcelWorkSheetName $GpoSettings -FilePath $Env:UserProfile\Desktop\Export\$GpoSettings.xlsx -AutoFilter -AutoFit
}
}
+9 -44
View File
@@ -1,47 +1,12 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
#Invoke-GPOZaurr -OutputType Excel, Object, HTML -Open | Format-Table
#$Output = Invoke-GPOZaurr -GPOPath $Env:USERPROFILE\Desktop\GPOExport -NoTranslation #| Format-Table
#$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTestRegistryCheck' -NoTranslation
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -NoTranslation -Verbose
#$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExport' -NoTranslation #-OutputType HTML, Object -Open #| Format-Table
#$Output.Categories | Out-HtmlView
#$Output.Categories | Format-Table
$Output | Format-Table
#$Output.CategoriesFull | Format-Table
#$Output.Count
# Asses GPO based on exported data
$Output = Invoke-GPOZaurr -GPOPath $Env:USERPROFILE\Desktop\GPOExport -Verbose
#$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -Verbose
$Output | Format-Table *
$Output.Reports | Format-Table
#$Output.Reports.Scripts | Format-Table *
#$Output.Reports.AccountPolicies | Format-Table *
#$Output.Reports.Audit | Format-Table *
#$Output.Reports.Autologon | Format-Table *
#$Output.Reports.EventLog | Format-Table *
#$Output.Reports.SoftwareInstallation | Format-Table *
#$Output.Reports.Policies | Format-Table *
#Output.Reports.RegistrySettings | Format-Table *
#$Output.Reports.SecurityOptions | Format-Table *
#$Output.Reports.SystemServices | Format-Table *
#$Output.Reports.SystemServicesNT | Format-Table *
#$Output.Reports.LocalUsers | Format-Table *
#$Output.Reports.LocalGroups | Format-Table *
#$Output.Reports.DriveMapping | Format-Table *
#$Output.Reports.Printers | Format-Table *
$Output.Reports.TaskScheduler | Format-Table *
return
# This is section that treats 1 GPO as single object - if there are 5 scripts in 1 GPO there's only one value
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -NoTranslation -SingleObject
#$Output
#$Output.Reports | Format-Table
#$Output.Reports.Scripts | Format-Table *
#$Output.Reports.SoftwareInstallation | Format-Table *
#$Output.Reports.Policies | Format-Table *
#$Output.Reports.RegistrySettings | Format-Table *
#$Output.Reports.SecurityOptions | Format-Table *
#$Output.Reports.SystemServices | Format-Table *
#$Output.Reports.SystemServicesNT | Format-Table *
#$Output.Reports.LocalUsers | Format-Table *
#$Output.Reports.LocalGroups | Format-Table *
#$Output.Reports.DriveMapping | Format-Table *
$Output.Reports.Printers | Format-Table *
# Export to Excel
foreach ($Key in $Output.Reports.Keys) {
$Output.Reports[$Key] | ConvertTo-Excel -FilePath $Env:USERPROFILE\Desktop\EFGPOAnalysis.xlsx -ExcelWorkSheetName $Key -AutoFilter -AutoFit -FreezeTopRowFirstColumn
}
Start-Process "$Env:USERPROFILE\Desktop\EFGPOAnalysis.xlsx"
+13 -13
View File
@@ -1,20 +1,20 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
$Output = Invoke-GPOZaurr #-NoTranslation
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportEvotec1'
$Output | Format-Table
$Output.Reports.RegistrySettings | Format-Table *
$Output.Reports.InternetExplorerZones | Format-Table *
# Report to Excel of translated reports
foreach ($Key in $Output.Reports.Keys) {
$Output.Reports[$Key] | ConvertTo-Excel -FilePath $Env:USERPROFILE\Desktop\GPOAnalysis.xlsx -ExcelWorkSheetName $Key -AutoFilter -AutoFit -FreezeTopRowFirstColumn
}
# Report to HTML of translated reports
New-HTML {
foreach ($GPOCategory in $Output.Keys) {
New-HTMLTab -Name $GPOCategory {
if ($Output["$GPOCategory"] -is [System.Collections.IDictionary]) {
foreach ($GpoSettings in $Output["$GPOCategory"].Keys) {
New-HTMLTab -Name $GpoSettings {
New-HTMLTable -DataTable $Output[$GPOCategory][$GpoSettings] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
}
}
} else {
New-HTMLTable -DataTable $Output[$GPOCategory] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
}
foreach ($Key in $Output.Reports.Keys) {
New-HTMLTab -Name $Key {
New-HTMLTable -DataTable $Output.Reports[$Key] -Filtering
}
}
} -Online -ShowHTML -FilePath $Env:UserProfile\Desktop\OutputFromFindGPO.html
} -FilePath $Env:USERPROFILE\Desktop\GPOAnalysis.html -ShowHTML -Online
@@ -1,20 +0,0 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
$Output = Invoke-GPOZaurr -NoTranslation
$Output | Format-Table
New-HTML {
foreach ($GPOCategory in $Output.Keys) {
New-HTMLTab -Name $GPOCategory {
if ($Output["$GPOCategory"] -is [System.Collections.IDictionary]) {
foreach ($GpoSettings in $Output["$GPOCategory"].Keys) {
New-HTMLTab -Name $GpoSettings {
New-HTMLTable -DataTable $Output[$GPOCategory][$GpoSettings] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
}
}
} else {
New-HTMLTable -DataTable $Output[$GPOCategory] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
}
}
}
} -Online -ShowHTML -FilePath $Env:UserProfile\Desktop\OutputFromFindGPO-NoTranslation.html
+8
View File
@@ -0,0 +1,8 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# 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-GPOZaurr -SingleObject
$Output | Format-Table
$Output.Reports.RegistrySettings | Format-Table *
$Output.Reports.RegistrySettings[0].Settings | Format-Table *
-22
View File
@@ -1,22 +0,0 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# Use Save-GPOZaurrFiles -GPOPath $ENV:USERPROFILE\Desktop\GPOExport
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' # -NoTranslation
$Output | Format-Table *
New-HTML {
foreach ($GPOCategory in $Output.Keys) {
New-HTMLTab -Name $GPOCategory {
if ($Output["$GPOCategory"] -is [System.Collections.IDictionary]) {
foreach ($GpoSettings in $Output["$GPOCategory"].Keys) {
New-HTMLTab -Name $GpoSettings {
New-HTMLTable -DataTable $Output[$GPOCategory][$GpoSettings] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
}
}
} else {
New-HTMLTable -DataTable $Output[$GPOCategory] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
}
}
}
} -Online -ShowHTML -FilePath $Env:UserProfile\Desktop\OutputFromFindGPO-FromDisk.html
+13
View File
@@ -0,0 +1,13 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# Use Save-GPOZaurrFiles -GPOPath $ENV:USERPROFILE\Desktop\GPOExportAudit
$Output = Invoke-GPOZaurr -GPOPath $ENV:USERPROFILE\Desktop\GPOExportAudit -Verbose #-SkipCleanup #-Type PoliciesPrinters, Policies
$Output | Format-Table *
$Output.Reports | Format-Table
# Export to Excel
foreach ($Key in $Output.Reports.Keys) {
$Output.Reports[$Key] | ConvertTo-Excel -FilePath $Env:USERPROFILE\Desktop\GPOAnalysis.xlsx -ExcelWorkSheetName $Key -AutoFilter -AutoFit -FreezeTopRowFirstColumn
}
Start-Process "$Env:USERPROFILE\Desktop\GPOAnalysis.xlsx"
@@ -1,25 +0,0 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# Use Save-GPOZaurrFiles -GPOPath $ENV:USERPROFILE\Desktop\GPOExport
$OutputTranslation = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExport'
$OutputTranslation | Format-Table
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExport' -NoTranslation
$Output | Format-Table *
#$Output.LugsSettings.LocalUsersAndGroups | Format-List *
$GPOEntry = $Output.LugsSettings.LocalUsersAndGroups[0]
$CreateGPO = @{}
foreach ($User in $GPOEntry.User) {
# $User | Format-Table
# $User.Properties | Format-Table
}
foreach ($Group in $GPOEntry.Group) {
#$Group | Format-Table
$Group.Properties | Format-Table
$Group.Properties.Members | Format-Table
}
@@ -1,6 +0,0 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# Use Save-GPOZaurrFiles -GPOPath $ENV:USERPROFILE\Desktop\GPOExport
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -NoTranslation
$Output | Format-Table *
@@ -1,11 +0,0 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# This is purely for building GPO Dictionary, mostly for development needs to help asses what is there
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -NoTranslation
#$Output | Format-Table *
$LookingFor = $Output | Select-GPOTranslation -Category 'SecuritySettings' -Settings 'UserRightsAssignment'
$LookingFor | Format-Table
$LookingFor.Types | Format-Table
#$LookingFor.Data | Format-Table
@@ -1,6 +1,6 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
$Policies = Get-GPOZaurrFilesPolicyDefinitions -Signature
$Policies = Get-GPOZaurrFilesPolicyDefinition -Signature
$Policies | Format-Table
#$Policies.FilesToDelete | Format-Table *
$Policies['ad.evotec.xyz'] | Format-Table *
@@ -1,5 +1,7 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
Get-GPOZaurrEmptyFolders | Where-Object { $_.Name -eq 'Adm' } | Format-Table *
# Report on empty folders
Get-GPOZaurrFolders -FolderType Empty | Format-Table *
Remove-GPOZaurrEmptyFolders -Folders Adm -Verbose -LimitProcessing 1
# ! NOT READY FOR EMPTY
#Remove-GPOZaurrFolders -FolderType Empty -Verbose -BackupPath $Env:USERPROFILE\Desktop\SomeBackup1 -WhatIf
@@ -0,0 +1,7 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# Report on NTFRS folders
Get-GPOZaurrFolders -FolderType NTFRS | Format-Table *
# Remove NTFRS (broken replication folders)
Remove-GPOZaurrFolders -FolderType NTFRS -Verbose -BackupPath $Env:USERPROFILE\Desktop\SomeBackup -WhatIf
@@ -0,0 +1,10 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# Cleanup based on https://techcommunity.microsoft.com/t5/ask-the-directory-services-team/manually-clearing-the-conflictanddeleted-folder-in-dfsr/ba-p/395711
# Get dfsr information
$DFSR = Get-GPOZaurrSysvolDFSR
$DFSR | Format-Table *
# Cleanup DFSR Conflict Path
Clear-GPOZaurrSysvolDFSR -WhatIf
+5
View File
@@ -0,0 +1,5 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
Invoke-GPOZaurrSupport -ComputerName 'AD1' -UserName 'przemyslaw.klys' -Type HTML
#$Support
# $Support.ComputerResults.GPO | select name, @{LABEL=”LinkOrder“;EXPRESSION={$_.link.linkorder}} | sort linkorder
+21
View File
@@ -0,0 +1,21 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# Extracts CSE from registry
$AllRegistryExtensions = Find-CSExtension
$AllRegistryExtensions | Format-Table
# Uses Hashtable - similar to above but much faster
$AllRegistryExtensionsFaster = foreach ($CSE in $AllRegistryExtensions) {
ConvertFrom-CSExtension -CSE $CSE.CSE
}
$AllRegistryExtensionsFaster | Format-Table
# With this we can find out if we're missing anything in hashtable so we can update code if nessecary
$MissingEntries = foreach ($CSE in $AllRegistryExtensions) {
$Output = ConvertFrom-CSExtension -CSE $CSE.CSE
if ($Output.CSE -eq $Output.Description) {
# THis means the value in hashtable is missing this entry and we should add it
$CSE
}
}
$MissingEntries | Format-Table
@@ -0,0 +1,10 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
# Get basic output DN, CanonicalName, BlockInheritance (True/False)
#$Objects = Get-GPOZaurrInheritance
#$Objects | Format-Table
# Get same output DN, CanonicalName, BlockInheritance (True/False) + Users/Computers + UsersCount/ComputerCount for those with Blocked Inhertiance
# This is so you can have a list what machines are affected
$Objects = Get-GPOZaurrInheritance -IncludeBlockedObjects -OnlyBlockedInheritance
$Objects | Format-Table
+5 -5
View File
@@ -1,13 +1,13 @@
@{
AliasesToExport = 'Find-GPO'
AliasesToExport = 'Get-GPOZaurrFilesPolicyDefinitions', 'Find-GPO'
Author = 'Przemyslaw Klys'
CompanyName = 'Evotec'
CompatiblePSEditions = 'Desktop'
Copyright = '(c) 2011 - 2020 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', 'Get-GPOZaurr', 'Get-GPOZaurrAD', 'Get-GPOZaurrBackupInformation', 'Get-GPOZaurrEmptyFolders', 'Get-GPOZaurrFiles', 'Get-GPOZaurrFilesPolicyDefinitions', 'Get-GPOZaurrLegacyFiles', 'Get-GPOZaurrLink', 'Get-GPOZaurrLinkSummary', 'Get-GPOZaurrOwner', 'Get-GPOZaurrPassword', 'Get-GPOZaurrPermission', 'Get-GPOZaurrPermissionConsistency', 'Get-GPOZaurrSysvol', 'Get-WMIFilter', 'Get-GPOZaurrWMI', 'Invoke-GPOZaurr', 'Invoke-GPOZaurrPermission', 'New-GPOZaurrWMI', 'Remove-GPOPermission', 'Remove-GPOZaurr', 'Remove-GPOZaurrEmptyFolders', 'Remove-GPOZaurrLegacyFiles', 'Remove-GPOZaurrOrphanedSysvolFolders', 'Remove-GPOZaurrPermission', 'Remove-GPOZaurrWMI', 'Repair-GPOZaurrPermissionConsistency', 'Restore-GPOZaurr', 'Save-GPOZaurrFiles', 'Select-GPOTranslation', 'Set-GPOOwner', 'Set-GPOZaurrOwner'
FunctionsToExport = 'Add-GPOPermission', 'Add-GPOZaurrPermission', 'Backup-GPOZaurr', 'Clear-GPOZaurrSysvolDFSR', 'ConvertFrom-CSExtension', 'Find-CSExtension', 'Get-GPOZaurr', 'Get-GPOZaurrAD', 'Get-GPOZaurrBackupInformation', 'Get-GPOZaurrDictionary', 'Get-GPOZaurrFiles', 'Get-GPOZaurrFilesPolicyDefinition', 'Get-GPOZaurrFolders', 'Get-GPOZaurrInheritance', 'Get-GPOZaurrLegacyFiles', 'Get-GPOZaurrLink', 'Get-GPOZaurrLinkSummary', 'Get-GPOZaurrOwner', 'Get-GPOZaurrPassword', 'Get-GPOZaurrPermission', 'Get-GPOZaurrPermissionConsistency', 'Get-GPOZaurrSysvol', 'Get-GPOZaurrSysvolDFSR', 'Get-GPOZaurrWMI', 'Invoke-GPOZaurr', 'Invoke-GPOZaurrPermission', 'Invoke-GPOZaurrSupport', 'New-GPOZaurrWMI', 'Remove-GPOPermission', 'Remove-GPOZaurr', 'Remove-GPOZaurrFolders', 'Remove-GPOZaurrLegacyFiles', 'Remove-GPOZaurrOrphanedSysvolFolders', 'Remove-GPOZaurrPermission', 'Remove-GPOZaurrWMI', 'Repair-GPOZaurrPermissionConsistency', 'Restore-GPOZaurr', 'Save-GPOZaurrFiles', 'Set-GPOOwner', 'Set-GPOZaurrOwner'
GUID = 'f7d4c9e4-0298-4f51-ad77-e8e3febebbde'
ModuleVersion = '0.0.48'
ModuleVersion = '0.0.55'
PowerShellVersion = '5.1'
PrivateData = @{
PSData = @{
@@ -17,11 +17,11 @@
}
}
RequiredModules = @{
ModuleVersion = '0.0.160'
ModuleVersion = '0.0.166'
ModuleName = 'PSSharedGoods'
Guid = 'ee272aa8-baaa-4edf-9f45-b6d6f7d844fe'
}, @{
ModuleVersion = '0.0.63'
ModuleVersion = '0.0.66'
ModuleName = 'ADEssentials'
Guid = '9fc9fd61-7f11-4f4b-a527-084086f1905f'
}, 'ActiveDirectory', 'GroupPolicy', 'CimCmdlets', 'Microsoft.PowerShell.Management', 'Microsoft.PowerShell.Utility'
+243
View File
@@ -0,0 +1,243 @@
function ConvertFrom-XMLRSOP {
[cmdletBinding()]
param(
[System.Xml.XmlElement]$Content,
[string] $ResultsType,
[Microsoft.GroupPolicy.GPRsop] $ResultantSetPolicy,
[string] $Splitter = [System.Environment]::NewLine
)
$GPOPrimary = [ordered] @{
Summary = $null
SummaryDetails = [System.Collections.Generic.List[PSCustomObject]]::new()
SummaryDownload = $null
ResultantSetPolicy = $ResultantSetPolicy
GroupPolicies = $null
GroupPoliciesLinks = $null
GroupPoliciesApplied = $null
GroupPoliciesDenied = $null
Results = [ordered]@{}
}
$Object = [ordered] @{
ReadTime = [DateTime] $Content.ReadTime
ComputerName = $Content.$ResultsType.Name
DomainName = $Content.$ResultsType.Domain
OrganizationalUnit = $Content.$ResultsType.SOM
Site = $Content.$ResultsType.Site
GPOTypes = $Content.$ResultsType.ExtensionData.Name.'#text' -join $Splitter
SlowLink = if ($Content.$ResultsType.SlowLink -eq 'true') { $true } else { $false };
}
$GPOPrimary['Summary'] = $Object
[Array] $GPOPrimary['SecurityGroups'] = foreach ($Group in $Content.$ResultsType.SecurityGroup) {
[PSCustomObject] @{
Name = $Group.Name.'#Text'
SID = $Group.SID.'#Text'
}
}
[Array] $GPOPrimary['GroupPolicies'] = foreach ($GPO in $Content.$ResultsType.GPO) {
<#
$EventsReason = @{
'NOTAPPLIED-EMPTY' = 'Not Applied (Empty)'
'DENIED-WMIFILTER' = 'Denied (WMI Filter)'
'DENIED-SECURITY' = 'Denied (Security)'
}
#>
# Lets translate CSE extensions as some didn't translate automatically
$ExtensionName = $GPO.ExtensionName | ForEach-Object {
ConvertFrom-CSExtension -CSE $_ -Limited
}
$GPOObject = [PSCustomObject] @{
Name = $GPO.Name
#Path = $GPO.Path
GUID = $GPO.Path.Identifier.'#text'
DomainName = if ($GPO.Path.Domain.'#text') { $GPO.Path.Domain.'#text' } else { 'Local Policy' };
#VersionDirectory = $GPO.VersionDirectory
#VersionSysvol = $GPO.VersionSysvol
Revision = -join ('AD (', $GPO.VersionDirectory, '), SYSVOL (', $GPO.VersionSysvol, ')')
IsValid = if ($GPO.IsValid -eq 'true') { $true } else { $false };
Status = if ($GPO.FilterAllowed -eq 'true' -and $GPO.AccessDenied -eq 'false') { 'Applied' } else { 'Denied' };
FilterAllowed = if ($GPO.FilterAllowed -eq 'true') { $true } else { $false };
AccessAllowed = if ($GPO.AccessDenied -eq 'true') { $false } else { $true };
FilterName = $GPO.FilterName # : Test
ExtensionName = ($ExtensionName | Sort-Object -Unique) -join '; '
# This isn't really pretty for large amount of links but can be useful for assesing things
SOMOrder = $GPO.Link.SOMOrder -join '; '
AppliedOrder = $GPO.Link.AppliedOrder -join '; '
LinkOrder = $GPO.Link.LinkOrder -join '; '
Enabled = ($GPO.Link.Enabled | ForEach-Object { if ($_ -eq 'true') { $true } else { $false }; }) -join '; '
Enforced = ($GPO.Link.NoOverride | ForEach-Object { if ($_ -eq 'true') { $true } else { $false }; }) -join '; ' # : true
SecurityFilter = $GPO.SecurityFilter -join '; ' # SecurityFilter : {NT AUTHORITY\Authenticated Users, EVOTEC\GDS-TestGroup3}
FilterId = $GPO.FilterID # : MSFT_SomFilter.ID="{ff08bc72-dae6-4890-b4cf-85a9c3b00056}",Domain="ad.evotec.xyz"
Links = $GPO.Link.SOMPath -join '; '
}
$GPOObject
}
[Array] $GPOPrimary['GroupPoliciesLinks'] = foreach ($GPO in $Content.$ResultsType.GPO) {
foreach ($Link in $GPO.Link) {
[PSCustomObject] @{
DisplayName = $GPO.Name
DomainName = $GPO.Path.Domain.'#text'
GUID = $GPO.Path.Identifier.'#text'
SOMPath = $Link.SOMPath # : ad.evotec.xyz
SOMOrder = $Link.SOMOrder # : 2
AppliedOrder = $Link.AppliedOrder # : 0
LinkOrder = $Link.LinkOrder # : 4
Enabled = if ($Link.Enabled -eq 'true') { $true } else { $false }; # : true
Enforced = if ($Link.NoOverride -eq 'true') { $true } else { $false }; # : true
}
}
}
[Array] $GPOPrimary['ScopeOfManagement'] = foreach ($SOM in $Content.$ResultsType.SearchedSOM) {
[PSCustomObject] @{
Path = $SOM.Path
Type = $SOM.Type
Order = $SOM.Order
BlocksInheritance = if ($SOM.BlocksInheritance -eq 'true') { $true } else { $false };
Blocked = if ($SOM.Blocked -eq 'true') { $true } else { $false };
Reason = if ($SOM.Reason -eq 'true') { $true } else { $false };
}
}
[Array] $GPOPrimary['ExtensionStatus'] = foreach ($Details in $Content.$ResultsType.ExtensionStatus) {
[PSCustomObject] @{
Name = $Details.Name # : Registry
Identifier = $Details.Identifier # : {35378EAC-683F-11D2-A89A-00C04FBBCFA2}
BeginTime = $Details.BeginTime # : 2020-04-02T12:05:10
EndTime = $Details.EndTime # : 2020-04-02T12:05:10
LoggingStatus = $Details.LoggingStatus # : Complete
Error = $Details.Error # : 0
}
}
[Array] $GPOPrimary['ExtensionData'] = $Content.$ResultsType.ExtensionData.Extension
foreach ($Single in $Content.$ResultsType.EventsDetails.SinglePassEventsDetails) {
$GPOPrimary['Results']["$($Single.ActivityId)"] = [ordered] @{}
$GPOPrimary['Results']["$($Single.ActivityId)"]['SummaryDetails'] = [Ordered] @{
ActivityId = $Single.ActivityId # : {6400d0bf-ac88-4ee6-b2c2-ca2cbbab0695}
ProcessingTrigger = $Single.ProcessingTrigger # : Periodic
ProcessingAppMode = $Single.ProcessingAppMode # : Background
LinkSpeedInKbps = $Single.LinkSpeedInKbps # : 0
SlowLinkThresholdInKbps = $Single.SlowLinkThresholdInKbps # : 500
DomainControllerName = $Single.DomainControllerName # : AD1.ad.evotec.xyz
DomainControllerIPAddress = $Single.DomainControllerIPAddress # : 192.168.240.189
PolicyProcessingMode = $Single.PolicyProcessingMode # : None
PolicyElapsedTimeInMilliseconds = $Single.PolicyElapsedTimeInMilliseconds # : 1202
ErrorCount = $Single.ErrorCount # : 0
WarningCount = $Single.WarningCount # : 0
}
$GPOPrimary['SummaryDetails'].Add([PSCustomObject] $GPOPrimary['Results']["$($Single.ActivityId)"]['SummaryDetails'])
[Array] $GPOPrimary['Results']["$($Single.ActivityId)"]['ProcessingTime'] = foreach ($Details in $Single.ExtensionProcessingTime) {
[PSCustomObject] @{
ExtensionName = $Details.ExtensionName
ExtensionGuid = $Details.ExtensionGuid
ElapsedTimeInMilliseconds = $Details.ElapsedTimeInMilliseconds
ProcessedTimeStamp = $Details.ProcessedTimeStamp
}
}
$EventsLevel = @{
'5' = 'Verbose'
'4' = 'Informational'
'3' = 'Warning'
'2' = 'Error'
'1' = 'Critical'
'0' = 'LogAlways'
}
$EventsReason = @{
'NOTAPPLIED-EMPTY' = 'Not Applied (Empty)'
'DENIED-WMIFILTER' = 'Denied (WMI Filter)'
'DENIED-SECURITY' = 'Denied (Security)'
}
[Array] $GPOPrimary['Results']["$($Single.ActivityId)"]['Events'] = foreach ($Event in $Single.EventRecord) {
[xml] $EventDetails = $Event.EventXML
$EventInformation = [ordered] @{
Description = $Event.EventDescription
Provider = $EventDetails.Event.System.Provider.Name # : Provider
ProviderGUID = $EventDetails.Event.System.Provider.Guid
EventID = $EventDetails.Event.System.EventID # : 4006
Version = $EventDetails.Event.System.Version # : 1
Level = $EventsLevel[$EventDetails.Event.System.Level] # : 4
Task = $EventDetails.Event.System.Task # : 0
Opcode = $EventDetails.Event.System.Opcode # : 1
Keywords = $EventDetails.Event.System.Keywords # : 0x4000000000000000
TimeCreated = [DateTime] $EventDetails.Event.System.TimeCreated.SystemTime # : TimeCreated, 2020-08-09T20:16:44.5668052Z
EventRecordID = $EventDetails.Event.System.EventRecordID # : 10641325
Correlation = $EventDetails.Event.System.Correlation.ActivityID # : Correlation
Execution = -join ("ProcessID: ", $EventDetails.Event.System.Execution.ProcessID, " ThreadID: ", $EventDetails.Event.System.Execution.ThreadID) # : Execution
Channel = $EventDetails.Event.System.Channel # : Microsoft-Windows-GroupPolicy / Operational
Computer = $EventDetails.Event.System.Computer # : AD1.ad.evotec.xyz
Security = $EventDetails.Event.System.Security.UserID # : Security
}
foreach ($Entry in $EventDetails.Event.EventData.Data) {
$EventInformation["$($Entry.Name)"] = $Entry.'#text'
}
[PSCustomObject] $EventInformation
}
# Lets build events by ID, this will be useful for better/easier processing
$GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID'] = [ordered] @{}
$GroupedEvents = $GPOPrimary['Results']["$($Single.ActivityId)"]['Events'] | Group-Object -Property EventId
foreach ($Events in $GroupedEvents) {
$GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID'][$Events.Name] = $Events.Group
}
$GPOPrimary['Results']["$($Single.ActivityId)"]['GroupPoliciesApplied'] = & {
if ($GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5312']) {
[xml] $GPODetailsApplied = -join ('<Details>', $GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5312'].GPOinfoList, '</Details>')
foreach ($GPO in $GPODetailsApplied.Details.GPO) {
$ReturnObject = [ordered] @{
GUID = $GPO.ID # : { 4E1F9C70-1DDB-4AB6-BBA3-14A8E07F0B4B }
DisplayName = $GPO.Name # : DC | Event Log Settings
Version = $GPO.Version # : 851981
Link = $GPO.SOM # : LDAP: / / OU = Domain Controllers, DC = ad, DC = evotec, DC = xyz
SysvolPath = $GPO.FSPath # : \\ad.evotec.xyz\SysVol\ad.evotec.xyz\Policies\ { 4E1F9C70-1DDB-4AB6-BBA3-14A8E07F0B4B }\Machine
#GPOTypes = $GPO.Extensions -join '; ' # : [ { 35378EAC-683F-11D2-A89A-00C04FBBCFA2 } { D02B1F72 - 3407 - 48AE-BA88-E8213C6761F1 }]
}
$TranslatedExtensions = foreach ($Extension in $GPO.Extensions) {
ConvertFrom-CSExtension -CSE $Extension -Limited
}
$ReturnObject['GPOTypes'] = $TranslatedExtensions -join '; '
[PSCustomObject] $ReturnObject
}
}
}
$GPOPrimary['Results']["$($Single.ActivityId)"]['GroupPoliciesDenied'] = & {
if ($GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5312']) {
[xml] $GPODetailsDenied = -join ('<Details>', $GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5313'].GPOinfoList, '</Details>')
foreach ($GPO in $GPODetailsDenied.Details.GPO) {
[PSCustomObject] @{
GUID = $GPO.ID #: { 6AC1786C-016F-11D2-945F-00C04fB984F9 }
DisplayName = $GPO.Name #: Default Domain Controllers Policy
Version = $GPO.Version #: 131074
Link = $GPO.SOM #: LDAP: / / OU = Domain Controllers, DC = ad, DC = evotec, DC = xyz
SysvolPath = $GPO.FSPath #: \\ad.evotec.xyz\sysvol\ad.evotec.xyz\Policies\ { 6AC1786C-016F-11D2-945F-00C04fB984F9 }\Machine
Reason = $EventsReason["$($GPO.Reason)"] #: DENIED-WMIFILTER
}
}
}
}
$GPOPrimary['Results']["$($Single.ActivityId)"]['SummaryDownload'] = & {
if ($GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5126']) {
[PSCustomObject] @{
IsBackgroundProcessing = if ($GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5126'].IsBackgroundProcessing -eq 'true') { $true } else { $false }; # : true
IsAsyncProcessing = if ($GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5126'].IsAsyncProcessing -eq 'true') { $true } else { $false }; # : false
Downloaded = $GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5126'].NumberOfGPOsDownloaded # : 7
Applicable = $GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5126'].NumberOfGPOsApplicable # : 6
DownloadTimeMiliseconds = $GPOPrimary['Results']["$($Single.ActivityId)"]['EventsByID']['5126'].GPODownloadTimeElapsedInMilliseconds # : 375
}
}
}
}
$GPOPrimary
}
+1 -1
View File
@@ -29,7 +29,7 @@
if ($GPOEntry.SettingBoolean) {
$CreateGPO[$($GPOEntry.Name)] = if ($GPOEntry.SettingBoolean -eq 'true') { 'Enabled' } elseif ($GPOEntry.SettingBoolean -eq 'false') { 'Disabled' } else { 'Not set' };
} elseif ($GPOEntry.SettingNumber) {
$CreateGPO[$($GPOEntry.Name)] = $GPOEntry.SettingNumber
$CreateGPO[$($GPOEntry.Name)] = [int] $GPOEntry.SettingNumber
}
}
$CreateGPO['Linked'] = $GPO.Linked
+97 -23
View File
@@ -4,36 +4,110 @@
[PSCustomObject] $GPO,
[switch] $FullObject
)
$SettingType = @{
'0' = 'No Auditing'
'1' = 'Success'
'2' = 'Failure'
'3' = 'Success, Failure'
}
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
AuditAccountLogon = 'No auditing'
AuditAccountManage = 'No auditing'
AuditDSAccess = 'No auditing'
AuditLogonEvents = 'No auditing'
AuditObjectAccess = 'No auditing'
AuditPolicyChange = 'No auditing'
AuditPrivilegeUse = 'No auditing'
AuditProcessTracking = 'No auditing'
AuditSystemEvents = 'No auditing'
AuditAccountLogon = 'Not configured'
AuditAccountManage = 'Not configured'
AuditDSAccess = 'Not configured'
AuditLogonEvents = 'Not configured'
AuditObjectAccess = 'Not configured'
AuditPolicyChange = 'Not configured'
AuditPrivilegeUse = 'Not configured'
AuditProcessTracking = 'Not configured'
AuditSystemEvents = 'Not configured'
# Advanced Policies
AuditAccountLockout = 'Not configured'
AuditApplicationGenerated = 'Not configured'
AuditApplicationGroupManagement = 'Not configured'
AuditAuditPolicyChange = 'Not configured'
AuditAuthenticationPolicyChange = 'Not configured'
AuditAuthorizationPolicyChange = 'Not configured'
AuditCentralAccessPolicyStaging = 'Not configured'
AuditCertificationServices = 'Not configured'
AuditComputerAccountManagement = 'Not configured'
AuditCredentialValidation = 'Not configured'
AuditDetailedDirectoryServiceReplication = 'Not configured'
AuditDetailedFileShare = 'Not configured'
AuditDirectoryServiceAccess = 'Not configured'
AuditDirectoryServiceChanges = 'Not configured'
AuditDirectoryServiceReplication = 'Not configured'
AuditDistributionGroupManagement = 'Not configured'
AuditDPAPIActivity = 'Not configured'
AuditFileShare = 'Not configured'
AuditFileSystem = 'Not configured'
AuditFilteringPlatformConnection = 'Not configured'
AuditFilteringPlatformPacketDrop = 'Not configured'
AuditFilteringPlatformPolicyChange = 'Not configured'
AuditGroupMembership = 'Not configured'
AuditHandleManipulation = 'Not configured'
AuditIPsecDriver = 'Not configured'
AuditIPsecExtendedMode = 'Not configured'
AuditIPsecMainMode = 'Not configured'
AuditIPsecQuickMode = 'Not configured'
AuditKerberosAuthenticationService = 'Not configured'
AuditKerberosServiceTicketOperations = 'Not configured'
AuditKernelObject = 'Not configured'
AuditLogoff = 'Not configured'
AuditLogon = 'Not configured'
AuditMPSSVCRuleLevelPolicyChange = 'Not configured'
AuditNetworkPolicyServer = 'Not configured'
AuditNonSensitivePrivilegeUse = 'Not configured'
AuditOtherAccountLogonEvents = 'Not configured'
AuditOtherAccountManagementEvents = 'Not configured'
AuditOtherLogonLogoffEvents = 'Not configured'
AuditOtherObjectAccessEvents = 'Not configured'
AuditOtherPolicyChangeEvents = 'Not configured'
AuditOtherPrivilegeUseEvents = 'Not configured'
AuditOtherSystemEvents = 'Not configured'
AuditPNPActivity = 'Not configured'
AuditProcessCreation = 'Not configured'
AuditProcessTermination = 'Not configured'
AuditRegistry = 'Not configured'
AuditRemovableStorage = 'Not configured'
AuditRPCEvents = 'Not configured'
AuditSAM = 'Not configured'
AuditSecurityGroupManagement = 'Not configured'
AuditSecurityStateChange = 'Not configured'
AuditSecuritySystemExtension = 'Not configured'
AuditSensitivePrivilegeUse = 'Not configured'
AuditSpecialLogon = 'Not configured'
AuditSystemIntegrity = 'Not configured'
AuditUserDeviceClaims = 'Not configured'
AuditUserAccountManagement = 'Not configured'
}
foreach ($GPOEntry in $GPO.DataSet) {
$SuccessAttempts = try { [bool]::Parse($GPOEntry.SuccessAttempts) } catch { $null };
$FailureAttempts = try { [bool]::Parse($GPOEntry.FailureAttempts) } catch { $null };
if ($SuccessAttempts -and $FailureAttempts) {
$Setting = 'Success, Failure'
} elseif ($SuccessAttempts) {
$Setting = 'Success'
} elseif ($FailureAttempts) {
$Setting = 'Failure'
if ($GPOEntry.PolicyTarget) {
# Category = 'AuditSettings', Settings = 'AuditSetting'
$Category = $GPOEntry.SubcategoryName -replace ' ', '' -replace '-', '' -replace '/', ''
if ($CreateGPO["$($Category)"]) {
$CreateGPO["$($Category)"] = $SettingType["$($GPOEntry.SettingValue)"]
}
} else {
$Setting = 'No auditing'
# Category = 'SecuritySettings', Settings = 'Audit'
$SuccessAttempts = try { [bool]::Parse($GPOEntry.SuccessAttempts) } catch { $null };
$FailureAttempts = try { [bool]::Parse($GPOEntry.FailureAttempts) } catch { $null };
if ($SuccessAttempts -and $FailureAttempts) {
$Setting = 'Success, Failure'
} elseif ($SuccessAttempts) {
$Setting = 'Success'
} elseif ($FailureAttempts) {
$Setting = 'Failure'
} else {
$Setting = 'Not configured'
}
$CreateGPO["$($GPOEntry.Name)"] = $Setting
}
$CreateGPO["$($GPOEntry.Name)"] = $Setting
}
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
+89
View File
@@ -0,0 +1,89 @@
function ConvertTo-XMLGenericPolicy {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[string[]] $Category
)
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
}
$UsedNames = [System.Collections.Generic.List[string]]::new()
[Array] $Policies = foreach ($Cat in $Category) {
$GPO.DataSet | Where-Object { $_.Category -like $Cat }
}
if ($Policies.Count -gt 0) {
foreach ($Policy in $Policies) {
#if ($Policy.Category -notlike $Category) {
# We check again for Category because one GPO can have multiple categories
# First check checks GPO globally,
# continue
#}
$Name = Format-ToTitleCase -Text $Policy.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
$CreateGPO[$Name] = $Policy.State
foreach ($Setting in @('DropDownList', 'Numeric', 'EditText', 'Text', 'CheckBox', 'ListBox')) {
if ($Policy.$Setting) {
foreach ($Value in $Policy.$Setting) {
if ($Value.Name) {
$SubName = Format-ToTitleCase -Text $Value.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
$SubName = -join ($Name, $SubName)
if ($SubName -notin $UsedNames) {
$UsedNames.Add($SubName)
} else {
$TimesUsed = $UsedNames | Group-Object | Where-Object { $_.Name -eq $SubName }
$NumberToUse = $TimesUsed.Count + 1
# We add same name 2nd and 3rd time to make sure we count properly
$UsedNames.Add($SubName)
# We now build property name based on amnount of times
$SubName = -join ($SubName, "$NumberToUse")
}
if ($Value.Value -is [string]) {
$CreateGPO["$SubName"] = $Value.Value
} elseif ($Value.Value -is [System.Xml.XmlElement]) {
<#
if ($null -eq $Value.Value.Name) {
# Shouldn't happen but lets see
Write-Verbose $Value
} else {
$CreateGPO["$SubName"] = $Value.Value.Name
}
#>
if ($Value.Value.Element) {
$CreateGPO["$SubName"] = $Value.Value.Element.Data -join '; '
} elseif ($null -eq $Value.Value.Name) {
# Shouldn't happen but lets see
Write-Verbose "Tracking $Value"
} else {
$CreateGPO["$SubName"] = $Value.Value.Name
}
} elseif ($Value.State) {
$CreateGPO["$SubName"] = $Value.State
} elseif ($null -eq $Value.Value) {
# This is most likely Setting 'Text
# Do nothing, usually it's just a text to display
#Write-Verbose "Skipping value for display because it's empty. Name: $($Value.Name)"
} else {
# shouldn't happen
Write-Verbose $Value
}
}
}
}
}
}
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
#}
}
}
+74
View File
@@ -0,0 +1,74 @@
function ConvertTo-XMLGenericPublicKey {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[string[]] $Category
)
$SkipNames = ('Name', 'LocalName', 'NamespaceURI', 'Prefix', 'NodeType', 'ParentNode', 'OwnerDocument', 'IsEmpty', 'Attributes', 'HasAttributes', 'SchemaInfo', 'InnerXml', 'InnerText', 'NextSibling', 'PreviousSibling', 'ChildNodes', 'FirstChild', 'LastChild', 'HasChildNodes', 'IsReadOnly', 'OuterXml', 'BaseURI', 'PreviousText')
foreach ($Setting in $GPO.DataSet) {
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
}
$SettingName = $Setting.Name -split ":"
$CreateGPO['CreatedTime'] = $GPO.CreatedTime # : 06.06.2020 18:03:36
$CreateGPO['ModifiedTime'] = $GPO.ModifiedTime # : 17.06.2020 16:08:10
$CreateGPO['ReadTime'] = $GPO.ReadTime # : 13.08.2020 10:15:37
$CreateGPO['SecurityDescriptor'] = $GPO.SecurityDescriptor # : SecurityDescriptor
$CreateGPO['FilterDataAvailable'] = $GPO.FilterDataAvailable # : True
$Name = $SettingName[1]
#$Name = Format-ToTitleCase -Text $Setting.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
$CreateGPO['Name'] = $Name # $Setting.Name
#$CreateGPO['GPOSettingOrder'] = $Setting.GPOSettingOrder
#foreach ($Property in ($Setting.Properties | Get-Member -MemberType Properties).Name) {
ConvertTo-XMLNested -CreateGPO $CreateGPO -Setting $Setting -SkipNames $SkipNames #-Name $Name
<#
$Properties = $Setting.PSObject.Properties.Name | Where-Object { $_ -notin $SkipNames }
foreach ($Property in $Properties) {
If ($Property -eq 'Value') {
if ($Setting.$Property) {
#$SubProperties = $Setting.$Property.PSObject.Properties.Name
if ($Setting.$Property.Name) {
$Name = $Setting.$Property.Name
} else {
$Name = 'Value'
}
if ($Setting.$Property.Number) {
$CreateGPO[$Name] = $Setting.$Property.Number
} elseif ($Setting.$Property.String) {
$CreateGPO[$Name] = $Setting.$Property.String
} else {
throw
}
}
} else {
$Name = Format-CamelCaseToDisplayName -Text $Property #-RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
if ($Setting.$Property -is [System.Xml.XmlElement]) {
$SubPropeties = $Setting.$Property.PSObject.Properties.Name | Where-Object { $_ -notin $SkipNames }
} else {
$CreateGPO[$Name] = $Setting.$Property
}
}
}
#>
$CreateGPO['Filters'] = $Setting.Filters
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
}
}
@@ -0,0 +1,45 @@
function ConvertTo-XMLGenericSecuritySettings {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[string[]] $Category
)
$SkipNames = ('Name', 'LocalName', 'NamespaceURI', 'Prefix', 'NodeType', 'ParentNode', 'OwnerDocument', 'IsEmpty', 'Attributes', 'HasAttributes', 'SchemaInfo', 'InnerXml', 'InnerText', 'NextSibling', 'PreviousSibling', 'Value', 'ChildNodes', 'FirstChild', 'LastChild', 'HasChildNodes', 'IsReadOnly', 'OuterXml', 'BaseURI', 'PreviousText')
$UsedNames = [System.Collections.Generic.List[string]]::new()
[Array] $Settings = foreach ($Cat in $Category) {
$GPO.DataSet | Where-Object { $null -ne $_.$Cat }
}
if ($Settings.Count -gt 0) {
foreach ($Cat in $Category) {
foreach ($Setting in $Settings.$Cat) {
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
}
#$Name = Format-ToTitleCase -Text $Setting.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
$CreateGPO['Name'] = $Setting.Name
$CreateGPO['GPOSettingOrder'] = $Setting.GPOSettingOrder
#foreach ($Property in ($Setting.Properties | Get-Member -MemberType Properties).Name) {
$Properties = $Setting.Properties.PSObject.Properties.Name | Where-Object { $_ -notin $SkipNames }
foreach ($Property in $Properties) {
$Name = Format-CamelCaseToDisplayName -Text $Property #-RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
$CreateGPO[$Name] = $Setting.Properties.$Property
}
$CreateGPO['Filters'] = $Setting.Filters
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
}
}
}
}
+49
View File
@@ -0,0 +1,49 @@
function ConvertTo-XMLNested {
[cmdletBinding()]
param(
[System.Collections.IDictionary] $CreateGPO,
[System.Xml.XmlElement] $Setting,
[string[]] $SkipNames,
[string] $Name
)
$Properties = $Setting.PSObject.Properties.Name | Where-Object { $_ -notin $SkipNames }
$TempName = $Name
foreach ($Property in $Properties) {
If ($Property -eq 'Value') {
if ($Setting.$Property) {
#$SubProperties = $Setting.$Property.PSObject.Properties.Name
if ($Setting.$Property.Name) {
$Name = $Setting.$Property.Name
} else {
if (-not $Name) {
$Name = 'Value'
}
}
if ($Setting.$Property.Number) {
$CreateGPO[$Name] = $Setting.$Property.Number
} elseif ($Setting.$Property.String) {
$CreateGPO[$Name] = $Setting.$Property.String
} else {
$CreateGPO[$Name] = $Setting.$Property
#throw
}
}
} else {
$Name = -join ($Name, $Property)
$Name = Format-CamelCaseToDisplayName -Text $Name #-RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
if ($Setting.$Property -is [System.Xml.XmlElement]) {
#$SubPropeties = $Setting.$Property.PSObject.Properties.Name | Where-Object { $_ -notin $SkipNames }
ConvertTo-XMLNested -Setting $Setting.$Property -CreateGPO $CreateGPO -Name $Name -SkipNames $SkipNames
} else {
$CreateGPO[$Name] = $Setting.$Property
}
}
$Name = $TempName
}
}
+2 -2
View File
@@ -10,7 +10,7 @@ function ConvertTo-XMLPrinterInternal {
$CreateGPO = [ordered]@{
Changed = try { [DateTime] $Entry.changed } catch { $Entry.Changed };
#uid = $Entry.uid
BypassErrors = if ($Entry.bypassErrors -eq '1') { $true } elseif ($Entry.bypassErrors -eq '0') { $false } else { $Entry.bypassErrors };
BypassErrors = if ($Entry.bypassErrors -eq '1') { $true } else { $false };
GPOSettingOrder = $Entry.GPOSettingOrder
Filter = $Entry.Filter
type = $Type
@@ -54,7 +54,7 @@ function ConvertTo-XMLPrinterInternal {
GpoSettings = $GPO.GpoSettings
Changed = try { [DateTime] $Entry.changed } catch { $Entry.Changed };
#uid = $Entry.uid
BypassErrors = if ($Entry.bypassErrors -eq '1') { $true } elseif ($Entry.bypassErrors -eq '0') { $false } else { $Entry.bypassErrors };
BypassErrors = if ($Entry.bypassErrors -eq '1') { $true } else { $false };
GPOSettingOrder = $Entry.GPOSettingOrder
Filter = $Entry.Filter
type = $Type
+3 -3
View File
@@ -41,9 +41,9 @@
$null -ne $CreateGPO['DefaultUserName'] -or
$null -ne $CreateGPO['DefaultPassword']
) {
$CreateGPO['Linked'] = $GPOEntry.Linked #: True
$CreateGPO['LinksCount'] = $GPOEntry.LinksCount #: 1
$CreateGPO['Links'] = $GPOEntry.Links #: area1.local
$CreateGPO['Linked'] = $GPOEntry.Linked
$CreateGPO['LinksCount'] = $GPOEntry.LinksCount
$CreateGPO['Links'] = $GPOEntry.Links
[PSCustomObject] $CreateGPO
}
}
@@ -0,0 +1,49 @@
function ConvertTo-XMLRegistryAutologonOnReport {
[cmdletBinding()]
param(
[PSCustomObject] $GPO
)
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
AutoAdminLogon = $null
DefaultDomainName = $null
DefaultUserName = $null
DefaultPassword = $null
DateChangedAutoAdminLogon = $null
DateChangedDefaultDomainName = $null
DateChangedDefaultUserName = $null
DateChangedDefaultPassword = $null
}
foreach ($Registry in $GPO.Settings) {
if ($Registry.Key -eq 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon') {
if ($Registry.Name -eq 'AutoAdminLogon') {
$CreateGPO['AutoAdminLogon'] = [bool] $Registry.value
$CreateGPO['DateChangedAutoAdminLogon'] = [DateTime] $Registry.changed
} elseif ($Registry.Name -eq 'DefaultDomainName') {
$CreateGPO['DefaultDomainName'] = $Registry.value
$CreateGPO['DateChangedDefaultDomainName'] = [DateTime] $Registry.changed
} elseif ($Registry.Name -eq 'DefaultUserName') {
$CreateGPO['DefaultUserName'] = $Registry.value
$CreateGPO['DateChangedDefaultUserName'] = [DateTime] $Registry.changed
} elseif ($Registry.Name -eq 'DefaultPassword') {
$CreateGPO['DefaultPassword'] = $Registry.value
$CreateGPO['DateChangedDefaultPassword'] = [DateTime] $Registry.changed
}
}
}
if ($null -ne $CreateGPO['AutoAdminLogon'] -or
$null -ne $CreateGPO['DefaultDomainName'] -or
$null -ne $CreateGPO['DefaultUserName'] -or
$null -ne $CreateGPO['DefaultPassword']
) {
$CreateGPO['Linked'] = $GPO.Linked #: True
$CreateGPO['LinksCount'] = $GPO.LinksCount #: 1
$CreateGPO['Links'] = $GPO.Links #: area1.local
[PSCustomObject] $CreateGPO
}
}
@@ -0,0 +1,76 @@
function ConvertTo-XMLRegistryInternetExplorerZones {
[cmdletBinding()]
param(
[PSCustomObject] $GPO
)
foreach ($Registry in $GPO.Settings) {
$Keys = @(
'Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\'
'Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\'
)
$Found = $false
foreach ($Key in $Keys) {
if ($Registry.Key -like "$Key*") {
$Found = $true
}
}
if ($Found -eq $false) {
continue
}
# https://support.microsoft.com/en-us/help/182569/internet-explorer-security-zones-registry-entries-for-advanced-users
if ($Registry.Key -like 'Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\*') {
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
}
$CreateGPO['Disabled'] = $Registry.Disabled
if ($Registry.Key -like '*EscDomains*') {
$CreateGPO['Configuration'] = 'Enhanced Security Configuration (ESC)'
} else {
$CreateGPO['Configuration'] = 'Domains'
}
if ($Registry.Hive -eq 'HKEY_CURRENT_USER') {
$CreateGPO['Type'] = 'User Policy'
} elseif ($Registry.Hive -eq 'HKEY_LOCAL_MACHINE') {
$CreateGPO['Type'] = 'Computer Policy'
} else {
$CreateGPO['Type'] = $Registry.Hive
}
if ($Registry.Value -eq '00000000') {
$CreateGPO['Zone'] = 'My Computer (0)'
} elseif ($Registry.Value -eq '00000001') {
$CreateGPO['Zone'] = 'Local Intranet Zone (1)'
} elseif ($Registry.Value -eq '00000002') {
$CreateGPO['Zone'] = 'Trusted Sites Zone (2)'
} elseif ($Registry.Value -eq '00000003') {
$CreateGPO['Zone'] = 'Internet Zone (3)'
} elseif ($Registry.Value -eq '00000004') {
$CreateGPO['Zone'] = 'Restricted Sites Zone (4)'
} else {
$CreateGPO['Zone'] = $Registry.Value
}
[string] $FullKey = foreach ($Key in $Keys) {
if ($Registry.Key -like "$Key*") {
$Registry.Key.Replace($Key, '')
}
}
$DomainSplit = $FullKey.Split('\')
$Reversed = for ($i = $DomainSplit.Count - 1; $i -ge 0; $i--) {
$DomainSplit[$i]
}
if ($Registry.Name -eq '*') {
$CreateGPO['DomainZone'] = $Reversed -join '.'
} else {
$CreateGPO['DomainZone'] = -join ($Registry.Name, '://', ($Reversed -join '.'))
}
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
}
}
}
-47
View File
@@ -17,59 +17,12 @@
}
[Array] $CreateGPO['Settings'] = Get-XMLNestedRegistry -GPO $GPO -DataSet $GPO.DataSet
<#
[Array] $CreateGPO['Settings'] = foreach ($Registry in $GPO.DataSet.Registry) {
[PSCustomObject] @{
Changed = [DateTime] $Registry.changed
GPOSettingOrder = $Registry.GPOSettingOrder
Hive = $Registry.Properties.hive #: HKEY_LOCAL_MACHINE
Key = $Registry.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name = $Registry.Properties.name #: AutoAdminLogon
Type = $Registry.Properties.type #: REG_SZ
Value = $Registry.Properties.value #
Filters = $Registry.Filters
}
}
#>
$CreateGPO['Count'] = $CreateGPO['Settings'].Count
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
} else {
<#
if ($GPO.DataSet.Registry) {
Get-XMLNestedRegistry -GPO $GPO -RegistryCollection $GPO.DataSet.Registry
}
if ($GPO.DataSet.Collection) {
Get-XMLNestedRegistry -GPO $GPO -RegistryCollection $GPO.DataSet.Collection
}
#>
Get-XMLNestedRegistry -GPO $GPO -DataSet $GPO.DataSet
<#
foreach ($Registry in $GPO.DataSet.Registry) {
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
Changed = [DateTime] $Registry.changed
GPOSettingOrder = $Registry.GPOSettingOrder
Hive = $Registry.Properties.hive #: HKEY_LOCAL_MACHINE
Key = $Registry.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name = $Registry.Properties.name #: AutoAdminLogon
Type = $Registry.Properties.type #: REG_SZ
Value = $Registry.Properties.value #
Filters = $Registry.Filters
}
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
}
#>
}
}
-15
View File
@@ -1,15 +0,0 @@
function Find-MissingProperties {
[cmdletBinding()]
param(
[Array] $Objects,
[string[]] $PossibleProperties
)
$AllProperties = Select-Properties -AllProperties -Objects $Objects
$MissingProperties = $AllProperties | Where-Object { $_ -notin 'DisplayName', 'DomainName', 'GUID', 'Linked', 'LinksCount', 'Links', 'GPOType', 'GPOCategory', 'GPOSettings' }
[Array] $ConsiderAdding = foreach ($Property in $MissingProperties) {
if ($Property -notin $PossibleProperties) {
$Property
}
}
$ConsiderAdding
}
+27
View File
@@ -0,0 +1,27 @@
function Format-CamelCaseToDisplayName {
[cmdletBinding()]
param(
[string[]] $Text,
[string] $AddChar
)
foreach ($string in $Text) {
$newString = ''
$stringChars = $string.GetEnumerator()
$charIndex = 0
foreach ($char in $stringChars) {
# If upper and not first character, add a space
if ([char]::IsUpper($char) -eq 'True' -and $charIndex -gt 0) {
$newString = $newString + $AddChar + $char.ToString()
} elseif ($charIndex -eq 0) {
# If the first character, make it a capital always
$newString = $newString + $char.ToString().ToUpper()
} else {
$newString = $newString + $char.ToString()
}
$charIndex++
}
$newString
}
}
#Format-CamelCaseToDisplayName -Text 'Test1', 'TestingMyAss', 'OtherTest', 'otherTEst'
+36 -20
View File
@@ -5,15 +5,33 @@
[Microsoft.GroupPolicy.Gpo] $GPO,
[switch] $PermissionsOnly,
[switch] $OwnerOnly,
[System.Collections.IDictionary] $ADAdministrativeGroups
[System.Collections.IDictionary] $ADAdministrativeGroups,
[string] $Splitter = [System.Environment]::NewLine
)
if ($XMLContent.GPO.LinksTo) {
$Linked = $true
$LinksCount = ([Array] $XMLContent.GPO.LinksTo).Count
$LinkSplit = ([Array] $XMLContent.GPO.LinksTo).Where( { $_.Enabled -eq $true }, 'Split')
[Array] $LinksEnabled = $LinkSplit[0]
[Array] $LinksDisabled = $LinkSplit[1]
$LinksEnabledCount = $LinksEnabled.Count
$LinksDisabledCount = $LinksDisabled.Count
$LinksTotalCount = ([Array] $XMLContent.GPO.LinksTo).Count
if ($LinksEnabledCount -eq 0) {
$Linked = $false
} else {
$Linked = $true
}
} else {
$Linked = $false
$LinksCount = 0
$LinksEnabledCount = 0
$LinksDisabledCount = 0
$LinksTotalCount = 0
}
if ($null -eq $XMLContent.GPO.Computer.ExtensionData -and $null -eq $XMLContent.GPO.User.ExtensionData) {
$Empty = $true
} else {
$Empty = $false
}
# Find proper values for enabled/disabled user/computer settings
if ($XMLContent.GPO.Computer.Enabled -eq 'False') {
@@ -98,8 +116,11 @@
'DisplayName' = $XMLContent.GPO.Name
'DomainName' = $XMLContent.GPO.Identifier.Domain.'#text'
'GUID' = $XMLContent.GPO.Identifier.Identifier.InnerText -replace '{' -replace '}'
'Empty' = $Empty
'Linked' = $Linked
'LinksCount' = $LinksCount
'LinksCount' = $LinksTotalCount
'LinksEnabledCount' = $LinksEnabledCount
'LinksDisabledCount' = $LinksDisabledCount
'Enabled' = $Enabled
'ComputerEnabled' = $ComputerEnabled
'UserEnabled' = $UserEnabled
@@ -111,14 +132,11 @@
'UserSettingsStatus' = if ($XMLContent.GPO.User.VersionDirectory -eq 0 -and $XMLContent.GPO.User.VersionSysvol -eq 0) { "NeverModified" } else { "Modified" }
'UserSettingsVersionIdentical' = if ($XMLContent.GPO.User.VersionDirectory -eq $XMLContent.GPO.User.VersionSysvol) { $true } else { $false }
'UserSettings' = $XMLContent.GPO.User.ExtensionData.Extension
ComputerPolicies = $XMLContent.GPO.Computer.ExtensionData.Name -join ", "
UserPolicies = $XMLContent.GPO.User.ExtensionData.Name -join ", "
'ComputerPolicies' = $XMLContent.GPO.Computer.ExtensionData.Name -join ", "
'UserPolicies' = $XMLContent.GPO.User.ExtensionData.Name -join ", "
'CreationTime' = [DateTime] $XMLContent.GPO.CreatedTime
'ModificationTime' = [DateTime] $XMLContent.GPO.ModifiedTime
'ReadTime' = [DateTime] $XMLContent.GPO.ReadTime
'WMIFilter' = $GPO.WmiFilter.name
'WMIFilterDescription' = $GPO.WmiFilter.Description
'GPODistinguishedName' = $GPO.Path
@@ -147,7 +165,14 @@
}
)
'Auditing' = if ($XMLContent.GPO.SecurityDescriptor.AuditingPresent.'#text' -eq 'true') { $true } else { $false }
'Links' = $XMLContent.GPO.LinksTo | ForEach-Object -Process {
'Links' = @(
$XMLContent.GPO.LinksTo | ForEach-Object -Process {
if ($_) {
$_.SOMPath
}
}
) -join $Splitter
'LinksObjects' = $XMLContent.GPO.LinksTo | ForEach-Object -Process {
if ($_) {
[PSCustomObject] @{
CanonicalName = $_.SOMPath
@@ -156,15 +181,6 @@
}
}
}
<#
SOMName SOMPath Enabled NoOverride
------- ------- ------- ----------
ad ad.evotec.xyz true false
#>
#| Select-Object -ExpandProperty SOMPath
}
}
#break
}
+90 -50
View File
@@ -9,57 +9,24 @@ function Get-XMLNestedRegistry {
if ($DataSet.Properties) {
$Registry = $DataSet
foreach ($Registry in $DataSet) {
if ($Limited) {
[PSCustomObject] @{
Collection = $Collection
Changed = [DateTime] $Registry.changed
GPOSettingOrder = $Registry.GPOSettingOrder
Hive = $Registry.Properties.hive #: HKEY_LOCAL_MACHINE
Key = $Registry.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name = $Registry.Properties.name #: AutoAdminLogon
Type = $Registry.Properties.type #: REG_SZ
Value = $Registry.Properties.value #
Filters = $Registry.Filters
}
} else {
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
Collection = $Collection
Changed = [DateTime] $Registry.changed
GPOSettingOrder = $Registry.GPOSettingOrder
Hive = $Registry.Properties.hive #: HKEY_LOCAL_MACHINE
Key = $Registry.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name = $Registry.Properties.name #: AutoAdminLogon
Type = $Registry.Properties.type #: REG_SZ
Value = $Registry.Properties.value #
Filters = $Registry.Filters
}
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
}
}
}
foreach ($Name in @('Registry', 'Collection')) {
foreach ($Registry in $DataSet.$Name) {
if ($Registry.Properties) {
if ($Limited) {
[PSCustomObject] @{
Collection = $Collection
Changed = [DateTime] $Registry.changed
GPOSettingOrder = $Registry.GPOSettingOrder
Description = $Registry.descr
Changed = try { [DateTime] $Registry.changed } catch { $Registry.changed };
Disabled = if ($Registry.disabled -eq '1') { $true } else { $false };
GPOSettingOrder = [int] $Registry.GPOSettingOrder
Action = $Script:Actions[$Registry.Properties.action]
DisplayDecimal = if ($Registry.Properties.displayDecimal -eq '1') { $true } else { $false };
Default = if ($Registry.Properties.default -eq '1') { $true } else { $false };
Hive = $Registry.Properties.hive #: HKEY_LOCAL_MACHINE
Key = $Registry.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name = $Registry.Properties.name #: AutoAdminLogon
Type = $Registry.Properties.type #: REG_SZ
Value = $Registry.Properties.value #
Filters = $Registry.Filters
BypassErrors = if ($Registry.bypassErrors -eq '1') { $true } else { $false };
}
} else {
$CreateGPO = [ordered]@{
@@ -70,14 +37,73 @@ function Get-XMLNestedRegistry {
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
Collection = $Collection
Changed = [DateTime] $Registry.changed
GPOSettingOrder = $Registry.GPOSettingOrder
Description = $Registry.descr
Changed = try { [DateTime] $Registry.changed } catch { $Registry.changed };
Disabled = if ($Registry.disabled -eq '1') { $true } else { $false };
GPOSettingOrder = [int] $Registry.GPOSettingOrder
Action = $Script:Actions[$Registry.Properties.action]
DisplayDecimal = if ($Registry.Properties.displayDecimal -eq '1') { $true } else { $false };
Default = if ($Registry.Properties.default -eq '1') { $true } else { $false };
Hive = $Registry.Properties.hive #: HKEY_LOCAL_MACHINE
Key = $Registry.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name = $Registry.Properties.name #: AutoAdminLogon
Type = $Registry.Properties.type #: REG_SZ
Value = $Registry.Properties.value #
Filters = $Registry.Filters
BypassErrors = if ($Registry.bypassErrors -eq '1') { $true } else { $false };
}
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
}
}
}
}
foreach ($Name in @('Registry', 'Collection')) {
foreach ($Registry in $DataSet.$Name) {
if ($Registry.Properties) {
if ($Limited) {
[PSCustomObject] @{
Collection = $Collection
Description = $Registry.descr
Changed = try { [DateTime] $Registry.changed } catch { $Registry.changed };
Disabled = if ($Registry.disabled -eq '1') { $true } else { $false };
GPOSettingOrder = [int] $Registry.GPOSettingOrder
Action = $Script:Actions[$Registry.Properties.action]
DisplayDecimal = if ($Registry.Properties.displayDecimal -eq '1') { $true } else { $false };
Default = if ($Registry.Properties.default -eq '1') { $true } else { $false };
Hive = $Registry.Properties.hive #: HKEY_LOCAL_MACHINE
Key = $Registry.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name = $Registry.Properties.name #: AutoAdminLogon
Type = $Registry.Properties.type #: REG_SZ
Value = $Registry.Properties.value #
Filters = $Registry.Filters
BypassErrors = if ($Registry.bypassErrors -eq '1') { $true } else { $false };
}
} else {
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
Collection = $Collection
Description = $Registry.descr
Changed = try { [DateTime] $Registry.changed } catch { $Registry.changed };
Disabled = if ($Registry.disabled -eq '1') { $true } else { $false };
GPOSettingOrder = [int] $Registry.GPOSettingOrder
Action = $Script:Actions[$Registry.Properties.action]
DisplayDecimal = if ($Registry.Properties.displayDecimal -eq '1') { $true } else { $false }; ;
Default = if ($Registry.Properties.default -eq '1') { $true } else { $false };
Hive = $Registry.Properties.hive #: HKEY_LOCAL_MACHINE
Key = $Registry.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name = $Registry.Properties.name #: AutoAdminLogon
Type = $Registry.Properties.type #: REG_SZ
Value = $Registry.Properties.value #
Filters = $Registry.Filters
BypassErrors = if ($Registry.bypassErrors -eq '1') { $true } else { $false };
}
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
@@ -86,10 +112,12 @@ function Get-XMLNestedRegistry {
}
} else {
if ($Registry.Registry) {
#$Collection = $Registry.name
#if ($Registry.Name.Count -gt 1) {
#Write-Verbose "Registry Name count more than 1"
#}
$TempCollection = $Collection
if ($Collection) {
$Collection = "$Collection\$($Registry.name)"
$Collection = "$Collection/$($Registry.name)"
} else {
$Collection = $Registry.name
}
@@ -97,12 +125,24 @@ function Get-XMLNestedRegistry {
$Collection = $TempCollection
}
if ($Registry.Collection) {
if ($Collection) {
$Collection = "$Collection\$($Registry.Collection.name)"
} else {
$Collection = "$($Registry.name)\$($Registry.Collection.name)"
$TempCollection = $Collection
#if ($Registry.Collection.Count -gt 1) {
# Write-Verbose "Registry collection count more than 1"
#}
foreach ($MyCollection in $Registry.Collection) {
if ($Collection) {
#Write-Verbose "Collection1: $Collection - $($Registry.name) - $($MyCollection.name) - $($($MyCollection.name).Count)"
$Collection = "$Collection/$($Registry.name)/$($MyCollection.name)"
#Write-Verbose "Collection2: $Collection"
} else {
#Write-Verbose "Collection3: $Collection - $($Registry.name) - $($MyCollection.name)"
$Collection = "$($Registry.name)/$($MyCollection.name)"
#Write-Verbose "Collection4: $Collection"
}
Get-XMLNestedRegistry -GPO $GPO -DataSet $MyCollection -Collection $Collection
$Collection = $TempCollection
}
Get-XMLNestedRegistry -GPO $GPO -DataSet $Registry.Collection -Collection $Collection
}
}
}
-72
View File
@@ -1,72 +0,0 @@
function Get-XMLOutput {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($GpoType in @('User', 'Computer')) {
if ($GPOOutput.$GpoType.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$GpoType.ExtensionData.Extension) {
# It's possible that one of the ExtensionType records has value null. Weird but happend.
if ($ExtensionType) {
$GPOSettingTypeSplit = ($ExtensionType.type -split ':')
try {
$KeysToLoop = $ExtensionType | Get-Member -MemberType Properties -ErrorAction Stop | Where-Object { $_.Name -notin 'type', $GPOSettingTypeSplit[0] -and $_.Name -notin @('Blocked') }
} catch {
Write-Warning "Get-XMLStandard - things went sideways $($_.Exception.Message)"
continue
}
foreach ($GpoSettings in $KeysToLoop.Name) {
$Template = [ordered] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
GpoType = $GpoType
GpoCategory = $GPOSettingTypeSplit[1]
GpoSettings = $GpoSettings
}
[PSCustomObject] $Template
}
continue
foreach ($GpoSettings in $KeysToLoop.Name) {
foreach ($Key in $ExtensionType.$GpoSettings) {
$Template = [ordered] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
GpoType = $GpoType
GpoCategory = $GPOSettingTypeSplit[1]
GpoSettings = $GpoSettings
}
try {
$Properties = ($Key | Get-Member -MemberType Properties -ErrorAction Stop).Name
} catch {
Write-Warning "Get-XMLStandard - things went sideways 1 $($_.Exception.Message)"
$Properties = $null
}
foreach ($Property in $Properties) {
$Template["$Property"] = $Key.$Property
}
$Template['Linked'] = $LinksInformation.Linked
$Template['LinksCount'] = $LinksInformation.LinksCount
$Template['Links'] = $LinksInformation.Links
<#
$Template['IncludeComments'] = $GPOOutput.IncludeComments # : true #: true
$Template['CreatedTime'] = $GPOOutput.CreatedTime # : 2020-06-17T11:23:22 #: 2020-06-17T11:23:22
$Template['ModifiedTime'] = $GPOOutput.ModifiedTime # : 2020-06-28T15:49:52 #: 2020-06-28T15:49:52
$Template['ReadTime'] = $GPOOutput.ReadTime # : 2020-06-28T16:14:09.2209011Z #: 2020-06-28T16:14:09.2209011Z
$Template['SecurityDescriptor'] = $GPOOutput.SecurityDescriptor # : SecurityDescriptor #: SecurityDescriptor
$Template['FilterDataAvailable'] = $GPOOutput.FilterDataAvailable # : true #: true
#>
[PSCustomObject] $Template
}
}
}
}
}
}
}
-59
View File
@@ -1,59 +0,0 @@
function Get-XMLStandard {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($GpoType in @('User', 'Computer')) {
if ($GPOOutput.$GpoType.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$GpoType.ExtensionData.Extension) {
# It's possible that one of the ExtensionType records has value null. Weird but happend.
if ($ExtensionType) {
$GPOSettingTypeSplit = ($ExtensionType.type -split ':')
try {
$KeysToLoop = $ExtensionType | Get-Member -MemberType Properties -ErrorAction Stop | Where-Object { $_.Name -notin 'type', $GPOSettingTypeSplit[0] -and $_.Name -notin @('Blocked') }
} catch {
Write-Warning "Get-XMLStandard - things went sideways $($_.Exception.Message)"
continue
}
foreach ($GpoSettings in $KeysToLoop.Name) {
foreach ($Key in $ExtensionType.$GpoSettings) {
$Template = [ordered] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
GpoType = $GpoType
GpoCategory = $GPOSettingTypeSplit[1]
GpoSettings = $GpoSettings
}
try {
$Properties = ($Key | Get-Member -MemberType Properties -ErrorAction Stop).Name
} catch {
Write-Warning "Get-XMLStandard - things went sideways 1 $($_.Exception.Message)"
$Properties = $null
}
foreach ($Property in $Properties) {
$Template["$Property"] = $Key.$Property
}
$Template['Linked'] = $LinksInformation.Linked
$Template['LinksCount'] = $LinksInformation.LinksCount
$Template['Links'] = $LinksInformation.Links
<#
$Template['IncludeComments'] = $GPOOutput.IncludeComments # : true #: true
$Template['CreatedTime'] = $GPOOutput.CreatedTime # : 2020-06-17T11:23:22 #: 2020-06-17T11:23:22
$Template['ModifiedTime'] = $GPOOutput.ModifiedTime # : 2020-06-28T15:49:52 #: 2020-06-28T15:49:52
$Template['ReadTime'] = $GPOOutput.ReadTime # : 2020-06-28T16:14:09.2209011Z #: 2020-06-28T16:14:09.2209011Z
$Template['SecurityDescriptor'] = $GPOOutput.SecurityDescriptor # : SecurityDescriptor #: SecurityDescriptor
$Template['FilterDataAvailable'] = $GPOOutput.FilterDataAvailable # : true #: true
#>
[PSCustomObject] $Template
}
}
}
}
}
}
}
-15
View File
@@ -1,15 +0,0 @@
function Invoke-GPOTranslation {
[cmdletBinding()]
param(
[System.Collections.IDictionary] $InputData,
[string] $Report,
[string] $Category,
[string] $Settings
)
if ($Category -and $Settings -and $InputData) {
if ($Script:GPODitionary[$Report]['Code']) {
$Script:GPOList = $InputData.$Category.$Settings
return & $Script:GPODitionary[$Report]['Code']
}
}
}
-56
View File
@@ -1,56 +0,0 @@
function New-ADForestDrives {
[cmdletbinding()]
param(
[string] $ForestName,
[string] $ObjectDN
)
if (-not $Global:ADDrivesMapped) {
if ($ForestName) {
$Forest = Get-ADForest -Identity $ForestName
} else {
$Forest = Get-ADForest
}
if ($ObjectDN) {
# This doesn't work because no Domain and no $Server
$DNConverted = (ConvertFrom-Distinguishedname -DistinguishedName $ObjectDN -ToDC) -replace '=' -replace ','
if (-not(Get-PSDrive -Name $DNConverted -ErrorAction SilentlyContinue)) {
try {
if ($Server) {
$null = New-PSDrive -Name $DNConverted -Root '' -PsProvider ActiveDirectory -Server $Server.Hostname[0] -Scope Global -WhatIf:$false
Write-Verbose "New-ADForestDrives - Mapped drive $Domain / $($Server.Hostname[0])"
} else {
$null = New-PSDrive -Name $DNConverted -Root '' -PsProvider ActiveDirectory -Server $Domain -Scope Global -WhatIf:$false
}
} catch {
Write-Warning "New-ADForestDrives - Couldn't map new AD psdrive for $Domain / $($Server.Hostname[0])"
}
}
} else {
foreach ($Domain in $Forest.Domains) {
try {
$Server = Get-ADDomainController -Discover -DomainName $Domain
$DomainInformation = Get-ADDomain -Server $Server.Hostname[0]
} catch {
Write-Warning "New-ADForestDrives - Can't process domain $Domain - $($_.Exception.Message)"
continue
}
$ObjectDN = $DomainInformation.DistinguishedName
$DNConverted = (ConvertFrom-Distinguishedname -DistinguishedName $ObjectDN -ToDC) -replace '=' -replace ','
if (-not(Get-PSDrive -Name $DNConverted -ErrorAction SilentlyContinue)) {
try {
if ($Server) {
$null = New-PSDrive -Name $DNConverted -Root '' -PsProvider ActiveDirectory -Server $Server.Hostname[0] -Scope Global -WhatIf:$false
Write-Verbose "New-ADForestDrives - Mapped drive $Domain / $Server"
} else {
$null = New-PSDrive -Name $DNConverted -Root '' -PsProvider ActiveDirectory -Server $Domain -Scope Global -WhatIf:$false
}
} catch {
Write-Warning "New-ADForestDrives - Couldn't map new AD psdrive for $Domain / $Server $($_.Exception.Message)"
}
}
}
}
$Global:ADDrivesMapped = $true
}
}
+52
View File
@@ -0,0 +1,52 @@
function New-GPOZaurrReportConsole {
param(
[System.Collections.IDictionary] $Results
)
Begin {
$GPODeny = @{
Color = 'Yellow', 'Red', 'Yellow', 'Red'
StartSpaces = 6
}
$GPOSuccess = @{
Color = 'Yellow', 'Green', 'Yellow', 'Green'
StartSpaces = 6
}
$WriteSummary = @{
Color = 'Yellow', 'Blue'
StartSpaces = 3
}
$ComputerWhereApplied = ($Results.ComputerResults.GroupPolicies | Sort-Object -Property DomainName, Name).Where( { $_.Status -eq 'Applied' }, 'split')
$UserWhereApplied = ($Results.UserResults.GroupPolicies | Sort-Object -Property Name).Where( { $_.Status -eq 'Applied' }, 'split')
}
Process {
Write-Color -Text 'Computer Settings' -Color White -LinesBefore 1
Write-Color -Text '[>] Last time Group Policy was applied: ', $Results.ComputerResults.Summary.ReadTime @WriteSummary
Write-Color -Text '[>] Computer Name: ', $Results.ComputerResults.Summary.ComputerName @WriteSummary
Write-Color -Text '[>] Domain Name: ', $Results.ComputerResults.Summary.DomainName @WriteSummary
Write-Color -Text '[>] Organizational Unit: ', $Results.ComputerResults.Summary.OrganizationalUnit @WriteSummary
Write-Color -Text '[>] Site: ', $Results.ComputerResults.Summary.Site @WriteSummary
Write-Color -Text '[>] GPO Types: ', ($Results.ComputerResults.Summary.GPOTypes -replace [System.Environment]::NewLine, ', ') @WriteSummary
Write-Color -Text '[>] Slow link: ', ($Results.ComputerResults.Summary.SlowLink) @WriteSummary
Write-Color -Text 'Applied Group Policy Objects' -StartSpaces 3 -LinesBefore 1
foreach ($GPO in $ComputerWhereApplied[0]) {
Write-Color -Text '[+] [', $GPO.DomainName, '] ', $GPO.Name @GPOSuccess
}
Write-Color -Text 'Denied Group Policy Objects' -StartSpaces 3
foreach ($GPO in $ComputerWhereApplied[1]) {
Write-Color -Text '[-] [', $GPO.DomainName, '] ', $GPO.Name @GPODeny
}
Write-Color -Text 'User Settings' -Color Yellow -LinesBefore 1
Write-Color -Text 'Applied Group Policy Objects' -StartSpaces 3
foreach ($GPO in $UserWhereApplied[0] ) {
Write-Color -Text '[+] [', $GPO.DomainName, '] ', $GPO.Name @GPOSuccess
}
Write-Color -Text 'Denied Group Policy Objects' -StartSpaces 3
foreach ($GPO in $UserWhereApplied[1]) {
Write-Color -Text '[-] [', $GPO.DomainName, '] ', $GPO.Name @GPODeny
}
}
}
+138
View File
@@ -0,0 +1,138 @@
function New-GPOZaurrReportHTML {
[cmdletBinding()]
param(
[System.Collections.IDictionary] $Support,
[string] $Path,
[switch] $Offline,
[switch] $Open
)
$PSDefaultParameterValues = @{
"New-HTMLTable:WarningAction" = 'SilentlyContinue'
}
if (-not $Path) {
$Path = [io.path]::GetTempFileName().Replace('.tmp', ".html")
}
$ComputerName = $($Support.ResultantSetPolicy.LoggingComputer)
#$UserName = $($Support.ResultantSetPolicy.UserName)
#$LoggingMode = $($Support.ResultantSetPolicy.LoggingMode)
New-HTML -TitleText "Group Policy Report - $ComputerName" {
#New-HTMLTabOptions -SlimTabs -Transition -LinearGradient -SelectorColor Akaroa
New-HTMLTabOptions -SlimTabs `
-BorderBottomStyleActive solid -BorderBottomColorActive LightSkyBlue -BackgroundColorActive none `
-TextColorActive Black -Align left -BorderRadius 0px -RemoveShadow -TextColor Grey -TextTransform capitalize
New-HTMLTab -Name 'Information' {
New-HTMLTable -DataTable $Support.ResultantSetPolicy -HideFooter
}
foreach ($Key in $Support.Keys) {
if ($Key -eq 'ResultantSetPolicy') {
continue
}
New-HTMLTab -Name $Key {
New-HTMLTab -Name 'Summary' {
New-HTMLSection -Invisible {
New-HTMLSection -HeaderText 'Summary' {
New-HTMLTable -DataTable $Support.$Key.Summary -Filtering -PagingOptions @(7, 14 )
New-HTMLTable -DataTable $Support.$Key.SummaryDetails -Filtering -PagingOptions @(7, 14)
}
New-HTMLSection -HeaderText 'Part of Security Groups' {
New-HTMLTable -DataTable $Support.$Key.SecurityGroups -Filtering -PagingOptions @(7, 14)
}
}
<#
New-HTMLSection -HeaderText 'Summary Downloads' {
New-HTMLTable -DataTable $Support.$Key.SummaryDownload -HideFooter
}
#>
New-HTMLSection -HeaderText 'Resultant Set Policy' {
New-HTMLTable -DataTable $Support.$Key.ResultantSetPolicy -HideFooter
}
}
New-HTMLTab -Name 'Group Policies' {
New-HTMLSection -Invisible {
<#
New-HTMLSection -HeaderText 'Processing Time' {
New-HTMLTable -DataTable $Support.$Key.ProcessingTime -Filtering
}
#>
New-HTMLSection -HeaderText 'ExtensionStatus' {
New-HTMLTable -DataTable $Support.$Key.ExtensionStatus -Filtering
}
}
New-HTMLSection -HeaderText 'Group Policies' {
New-HTMLTable -DataTable $Support.$Key.GroupPolicies -Filtering
}
New-HTMLSection -HeaderText 'Group Policies Links' {
New-HTMLTable -DataTable $Support.$Key.GroupPoliciesLinks -Filtering
}
<#
New-HTMLSection -HeaderText 'Group Policies Applied' {
New-HTMLTable -DataTable $Support.$Key.GroupPoliciesApplied -Filtering
}
New-HTMLSection -HeaderText 'Group Policies Denied' {
New-HTMLTable -DataTable $Support.$Key.GroupPoliciesDenied -Filtering
}
#>
}
New-HTMLTab -Name 'Extension Data' {
New-HTMLSection -HeaderText 'Extension Data' {
New-HTMLTable -DataTable $Support.$Key.ExtensionData -Filtering
}
}
New-HTMLTab -Name 'Scope of Management' {
New-HTMLSection -HeaderText 'Scope of Management' {
New-HTMLTable -DataTable $Support.$Key.ScopeOfManagement -Filtering
}
}
<#
New-HTMLTab -Name 'Events By ID' {
foreach ($ID in $Support.$Key.EventsByID.Keys) {
New-HTMLSection -HeaderText "Event ID $ID" {
New-HTMLTable -DataTable $Support.$Key.EventsByID[$ID] -Filtering -AllProperties
}
}
}
New-HTMLTab -Name 'Events' {
New-HTMLSection -HeaderText 'Events' {
New-HTMLTable -DataTable $Support.$Key.Events -Filtering -AllProperties
}
}
#>
}
}
if ($Support.ComputerResults.Results) {
New-HTMLTab -Name 'Details' {
foreach ($Detail in $Support.ComputerResults.Results.Keys) {
$ShortDetails = $Support.ComputerResults.Results[$Detail]
New-HTMLTab -Name $Detail {
New-HTMLTab -Name 'Test' {
New-HTMLSection -HeaderText 'Summary Downloads' {
New-HTMLTable -DataTable $ShortDetails.SummaryDownload -HideFooter
}
New-HTMLSection -HeaderText 'Processing Time' {
New-HTMLTable -DataTable $ShortDetails.ProcessingTime -Filtering
}
New-HTMLSection -HeaderText 'Group Policies Applied' {
New-HTMLTable -DataTable $ShortDetails.GroupPoliciesApplied -Filtering
}
New-HTMLSection -HeaderText 'Group Policies Denied' {
New-HTMLTable -DataTable $ShortDetails.GroupPoliciesDenied -Filtering
}
}
New-HTMLTab -Name 'Events By ID' {
foreach ($ID in $ShortDetails.EventsByID.Keys) {
New-HTMLSection -HeaderText "Event ID $ID" {
New-HTMLTable -DataTable $ShortDetails.EventsByID[$ID] -Filtering -AllProperties
}
}
}
New-HTMLTab -Name 'Events' {
New-HTMLSection -HeaderText 'Events' {
New-HTMLTable -DataTable $ShortDetails.Events -Filtering -AllProperties
}
}
}
}
}
}
} -Online:(-not $Offline.IsPresent) -Open:$Open.IsPresent -FilePath $Path
}
+752 -36
View File
@@ -1,12 +1,12 @@
$Script:GPODitionary = [ordered] @{
AccountPolicies = [ordered] @{
AccountPolicies = [ordered] @{
Types = @(
@{
Category = 'SecuritySettings'
Settings = 'Account'
}
)
GPOPath = 'Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Account Policies'
GPOPath = 'Policies -> Windows Settings -> Security Settings -> Account Policies'
Code = {
ConvertTo-XMLAccountPolicy -GPO $GPO
}
@@ -14,43 +14,220 @@
ConvertTo-XMLAccountPolicy -GPO $GPO
}
}
Audit = [ordered] @{
Audit = [ordered] @{
Types = @(
@{
Category = 'SecuritySettings'
Settings = 'Audit'
}
)
GPOPath = ''
Code = {
ConvertTo-XMLAudit -GPO $GPO
}
CodeSingle = {
ConvertTo-XMLAudit -GPO $GPO
}
}
Autologon = [ordered] @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'RegistrySettings'
Category = 'AuditSettings'
Settings = 'AuditSetting'
}
)
GPOPath = @(
'Policies -> Windows Settings -> Security Settings -> Advanced Audit Policy Configuration -> Audit Policies'
'Policies -> Windows Settings -> Security Settings -> Local Policies -> Audit Policy'
)
Code = {
ConvertTo-XMLRegistryAutologon -GPO $GPO
ConvertTo-XMLAudit -GPO $GPO
}
CodeSingle = {
ConvertTo-XMLRegistryAutologon -GPO $GPO
ConvertTo-XMLAudit -GPO $GPO
}
}
DriveMapping = [ordered] @{
Autologon = [ordered] @{
# We want to process this based on other report called RegistrySettings
# This is because registry settings can be stored in Collections or nested within other registry settings
# The original function ConvertTo-XMLRegistryAutologon was processing it in limited ordered and potentially would skip some entries.
ByReports = @(
@{
Report = 'RegistrySettings'
}
)
GPOPath = 'Preferences -> Windows Settings -> Registry'
CodeReport = {
ConvertTo-XMLRegistryAutologonOnReport -GPO $GPO
}
}
AutoPlay = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/AutoPlay Policies'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/AutoPlay Policies*'
}
}
Biometrics = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Biometrics'
Code = {
#ConvertTo-XMLBitlocker -GPO $GPO
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Biometrics*'
}
}
Bitlocker = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/BitLocker Drive Encryption'
Code = {
#ConvertTo-XMLBitlocker -GPO $GPO
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/BitLocker Drive Encryption*'
}
}
ControlPanel = [ordered]@{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Controol Panel'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel'
}
}
ControlPanelAddRemove = [ordered]@{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Control Panel/Add or Remove Programs'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Add or Remove Programs'
}
}
ControlPanelDisplay = [ordered]@{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Control Panel/Display'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Display'
}
}
ControlPanelPersonalization = [ordered]@{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Control Panel/Personalization'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Personalization'
}
}
ControlPanelPrinters = [ordered]@{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Control Panel/Printers'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Printers'
}
}
ControlPanelPrograms = [ordered]@{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Control Panel/Programs'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Programs'
}
}
ControlPanelRegional = [ordered]@{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Control Panel/Regional and Language Options'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Regional and Language Options'
}
}
CredentialsDelegation = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> System/Credentials Delegation'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Credentials Delegation*'
}
}
CustomInternationalSettings = [ordered]@{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Custom International Settings'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Custom International Settings*'
}
}
Desktop = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Desktop'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Desktop*'
}
}
DnsClient = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Network/DNS Client'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Network/DNS Client*'
}
}
DriveMapping = [ordered] @{
Types = @(
@{
Category = 'DriveMapSettings'
Settings = 'DriveMapSettings'
}
)
GPOPath = ''
GPOPath = 'Preferences -> Windows Settings -> Drive Maps'
Code = {
ConvertTo-XMLDriveMapSettings -GPO $GPO
}
@@ -58,14 +235,14 @@
ConvertTo-XMLDriveMapSettings -GPO $GPO -SingleObject
}
}
EventLog = [ordered] @{
EventLog = [ordered] @{
Types = @(
@{
Category = 'SecuritySettings'
Settings = 'EventLog'
}
)
GPOPath = ''
GPOPath = 'Policies -> Windows Settings -> Security Settings -> Event Log'
Code = {
ConvertTo-XMLEventLog -GPO $GPO
}
@@ -73,13 +250,174 @@
ConvertTo-XMLEventLog -GPO $GPO
}
}
LocalUsers = [ordered] @{
EventForwarding = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Event Forwarding'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Event Forwarding*'
}
}
EventLogService = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Event Log Service'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Event Log Service*'
}
}
FileExplorer = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/File Explorer'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/File Explorer*'
}
}
FolderRedirection = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> System/Folder Redirection'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Folder Redirection'
}
}
FSLogix = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> FSLogix'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'FSLogix'
}
}
GoogleChrome = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = @(
'Policies -> Administrative Templates -> Google Chrome'
'Policies -> Administrative Templates -> Google/Google Chrome'
'Policies -> Administrative Templates -> Google Chrome - Default Settings (users can override)'
)
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Google Chrome', 'Google/Google Chrome', 'Google Chrome - Default Settings (users can override)'
}
}
GroupPolicy = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> System/Group Policy'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Group Policy*'
}
}
InternetCommunicationManagement = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> System/Internet Communication Management'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Internet Communication Management*'
}
}
InternetExplorer = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Internet Explorer'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Internet Explorer*', 'Composants Windows/Celle Internet Explorer'
}
}
InternetExplorerZones = [ordered] @{
ByReports = @(
@{
Report = 'RegistrySettings'
}
)
GPOPath = 'Preferences -> Windows Settings -> Registry'
CodeReport = {
ConvertTo-XMLRegistryInternetExplorerZones -GPO $GPO
}
}
KDC = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> System/KDC'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/KDC'
}
}
LAPS = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> LAPS'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'LAPS'
}
}
Lithnet = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Lithnet/Password Protection for Active Directory'
Code = {
#ConvertTo-XMLLithnetFilter -GPO $GPO
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Lithnet/Password Protection for Active Directory*'
}
}
LocalUsers = [ordered] @{
Types = @(
@{
Category = 'LugsSettings'
Settings = 'LocalUsersAndGroups'
}
)
GPOPath = 'Preferences -> Control Panel Settings -> Local Users and Groups'
Code = {
ConvertTo-XMLLocalUser -GPO $GPO
}
@@ -87,13 +425,14 @@
ConvertTo-XMLLocalUser -GPO $GPO -SingleObject
}
}
LocalGroups = [ordered] @{
LocalGroups = [ordered] @{
Types = @(
@{
Category = 'LugsSettings'
Settings = 'LocalUsersAndGroups'
}
)
GPOPath = 'Preferences -> Control Panel Settings -> Local Users and Groups'
Code = {
ConvertTo-XMLLocalGroups -GPO $GPO
}
@@ -101,13 +440,163 @@
ConvertTo-XMLLocalGroups -GPO $GPO -SingleObject
}
}
Policies = @{
Logon = @{
Types = @(
@{ Category = 'RegistrySettings'; Settings = 'Policy' }
)
GPOPath = 'Policies -> Administrative Templates -> System/Logon'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Logon*'
}
}
MicrosoftOutlook2002 = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2002'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2002*'
}
}
MicrosoftEdge = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = @(
'Policies -> Administrative Templates -> Microsoft Edge'
'Policies -> Administrative Templates -> Windows Components/Edge UI'
'Policies -> Administrative Templates -> Windows Components/Microsoft Edge'
)
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Edge*', 'Windows Components/Microsoft Edge', 'Windows Components/Edge UI'
}
}
MicrosoftOutlook2003 = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = @(
'Policies -> Administrative Templates -> Microsoft Office Outlook 2003'
'Policies -> Administrative Templates -> Outlook 2003 RPC Encryption'
)
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Office Outlook 2003*', 'Outlook 2003 RPC Encryption'
}
}
MicrosoftOutlook2010 = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2010'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2010*'
}
}
MicrosoftOutlook2013 = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2013'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2013*'
}
}
MicrosoftOutlook2016 = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2016'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2016*'
}
}
MicrosoftManagementConsole = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Microsoft Management Console'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Microsoft Management Console*'
}
}
NetMeeting = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/NetMeeting'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/NetMeeting*'
}
}
MSSLegacy = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> MSS (Legacy)'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'MSS (Legacy)'
}
}
MSSecurityGuide = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> MS Security Guide'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'MS Security Guide'
}
}
OneDrive = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/OneDrive'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/OneDrive*'
}
}
Policies = @{
Comment = "This isn't really translated"
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates'
Code = {
ConvertTo-XMLPolicies -GPO $GPO
}
@@ -115,7 +604,7 @@
ConvertTo-XMLPolicies -GPO $GPO -SingleObject
}
}
Printers = @{
Printers = @{
Types = @(
@{
Category = 'PrintersSettings'
@@ -126,6 +615,7 @@
Settings = 'PrinterConnection'
}
)
GPOPath = 'Preferences -> Control Panel Settings -> Printers'
Code = {
ConvertTo-XMLPrinter -GPO $GPO
}
@@ -133,13 +623,29 @@
ConvertTo-XMLPrinter -GPO $GPO -SingleObject
}
}
RegistrySettings = [ordered] @{
PrintersPolicies = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = @(
'Policies -> Administrative Templates -> Printers'
'Policies -> Administrative Templates -> Control Panel/Printers'
)
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Printers*', 'Control Panel/Printers*'
}
}
RegistrySettings = [ordered] @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'RegistrySettings'
}
)
GPOPath = 'Preferences -> Windows Settings -> Registry'
Code = {
ConvertTo-XMLRegistrySettings -GPO $GPO
}
@@ -147,13 +653,62 @@
ConvertTo-XMLRegistrySettings -GPO $GPO -SingleObject
}
}
Scripts = [ordered] @{
OnlineAssistance = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Online Assistance'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Online Assistance*'
}
}
RemoteAssistance = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> System/Remote Assistance'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Remote Assistance*'
}
}
RemoteDesktopServices = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Remote Desktop Services'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Remote Desktop Services*'
}
}
RSSFeeds = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/RSS Feeds'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/RSS Feeds*'
}
}
Scripts = [ordered] @{
Types = @(
@{
Category = 'Scripts'
Settings = 'Script'
}
)
GPOPath = 'Policies -> Windows Settings -> Scripts'
Code = {
ConvertTo-XMLScripts -GPO $GPO
}
@@ -161,13 +716,14 @@
ConvertTo-XMLScripts -GPO $GPO -SingleObject
}
}
SecurityOptions = [ordered] @{
SecurityOptions = [ordered] @{
Types = @(
@{
Category = 'SecuritySettings'
Settings = 'SecurityOptions'
}
)
GPOPath = 'Policies -> Windows Settings -> Security Settings -> Local Policies -> Security Options'
Code = {
ConvertTo-XMLSecurityOptions -GPO $GPO
}
@@ -175,13 +731,14 @@
ConvertTo-XMLSecurityOptions -GPO $GPO -SingleObject
}
}
SoftwareInstallation = [ordered] @{
SoftwareInstallation = [ordered] @{
Types = @(
@{
Category = 'SoftwareInstallationSettings'
Settings = 'MsiApplication'
}
)
GPOPath = 'Policies -> Software Settings -> Software Installation'
Code = {
ConvertTo-XMLSoftwareInstallation -GPO $GPO
}
@@ -189,7 +746,7 @@
ConvertTo-XMLSoftwareInstallation -GPO $GPO -SingleObject
}
}
SystemServices = [ordered] @{
SystemServices = [ordered] @{
Types = @(
@{
Category = 'SecuritySettings'
@@ -197,7 +754,7 @@
}
)
Description = ''
GPOPath = 'Computer Configuration -> Policies -> Windows Settings -> Security Settings -> System Services'
GPOPath = 'Policies -> Windows Settings -> Security Settings -> System Services'
Code = {
ConvertTo-XMLSystemServices -GPO $GPO
}
@@ -205,7 +762,7 @@
ConvertTo-XMLSystemServices -GPO $GPO -SingleObject
}
}
SystemServicesNT = [ordered] @{
SystemServicesNT = [ordered] @{
Types = @(
@{
Category = 'ServiceSettings'
@@ -213,7 +770,7 @@
}
)
Description = ''
GPOPath = 'Computer Configuration -> Preferences -> Control Pannel Settings -> Services'
GPOPath = 'Preferences -> Control Pannel Settings -> Services'
Code = {
ConvertTo-XMLSystemServicesNT -GPO $GPO
}
@@ -221,7 +778,54 @@
ConvertTo-XMLSystemServicesNT -GPO $GPO -SingleObject
}
}
TaskScheduler = [ordered] @{
<#
SystemServicesNT1 = [ordered] @{
Types = @(
@{
Category = 'ServiceSettings'
Settings = 'NTServices'
}
)
Description = ''
GPOPath = 'Preferences -> Control Pannel Settings -> Services'
Code = {
ConvertTo-XMLSecuritySettings -GPO $GPO -Category 'NTService'
}
CodeSingle = {
ConvertTo-XMLSecuritySettings -GPO $GPO -SingleObject
}
}
#>
TaskScheduler = [ordered] @{
Types = @(
@{
Category = 'ScheduledTasksSettings'
Settings = 'ScheduledTasks'
}
)
Description = ''
GPOPath = 'Preferences -> Control Pannel Settings -> Scheduled Tasks'
Code = {
ConvertTo-XMLTaskScheduler -GPO $GPO
}
CodeSingle = {
ConvertTo-XMLTaskScheduler -GPO $GPO -SingleObject
}
}
TaskSchedulerPolicies = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Task Scheduler'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Task Scheduler*'
}
}
<#
TaskScheduler1 = [ordered] @{
Types = @(
@{
Category = 'ScheduledTasksSettings'
@@ -231,10 +835,122 @@
Description = ''
GPOPath = ''
Code = {
ConvertTo-XMLTaskScheduler -GPO $GPO
ConvertTo-XMLSecuritySettings -GPO $GPO -Category 'TaskV2', 'Task', 'ImmediateTaskV2', 'ImmediateTask'
}
CodeSingle = {
ConvertTo-XMLTaskScheduler -GPO $GPO -SingleObject
}
}
#>
WindowsDefender = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Defender'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Defender*'
}
}
WindowsHelloForBusiness = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Hello For Business'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Hello For Business*'
}
}
WindowsInstaller = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Installer'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Installer*'
}
}
WindowsLogon = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Logon Options'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Logon Options*'
}
}
WindowsMediaPlayer = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Media Player'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Media Player*'
}
}
WindowsMessenger = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Messenger'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Messenger*'
}
}
WindowsPowerShell = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows PowerShell'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows PowerShell*'
}
}
WindowsRemoteManagement = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Remote Management (WinRM)'
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Remote Management (WinRM)*'
}
}
WindowsUpdate = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
GPOPath = @(
'Policies -> Administrative Templates -> Windows Components/Windows Update'
#'Policies -> Administrative Templates -> Windows Components/Delivery Optimization'
)
Code = {
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Update*', 'Windows Components/Delivery Optimization*'
}
}
}
-52
View File
@@ -1,52 +0,0 @@
$Script:GPOPropetiesComputers = [ordered] @{
'Account' = ''
'Audit' = ''
'AuditSetting' = ''
'AutoEnrollmentSettings' = ''
'Blocked' = ''
'certSettingsTrustedPublishers' = ''
'DataSourcesSettings' = ''
'DomainProfile' = ''
'Dot3SvcSetting' = ''
'EFSRecoveryAgent' = ''
'EFSSettings' = ''
'EnvironmentVariables' = ''
'EventLog' = ''
'File' = ''
'FilesSettings' = ''
'Folders' = ''
'General' = ''
'Global' = ''
'GlobalSettings' = ''
'InboundFirewallRules' = ''
'IntermediateCACertificate' = ''
'InternetZoneRule' = ''
'LocalUsersAndGroups' = ''
'MsiApplication' = ''
'NetworkOptions' = ''
'NetworkShares' = ''
'NTServices' = ''
'OutboundFirewallRules' = ''
'PathRule' = ''
'Policy' = ''
'PowerOptions' = ''
'PrinterConnection' = ''
'Printers' = ''
'PrivateProfile' = ''
'PublicProfile' = ''
'Registry' = ''
'RegistrySetting' = ''
'RegistrySettings' = ''
'RestrictedGroups' = ''
'RootCertificate' = ''
'RootCertificateSettings' = ''
'ScheduledTasks' = ''
'Script' = ''
'SecurityOptions' = ''
'ShortcutSettings' = ''
'SystemServices' = ''
'TrustedPublishersCertificate' = ''
'type' = ''
'UserRightsAssignment' = ''
'WLanSvcSetting' = ''
}
-54
View File
@@ -1,54 +0,0 @@
$Script:GPOPropertiesUsers = [ordered] @{
'AutoDetectConfigSettings' = ''
'AutoEnrollmentSettings' = ''
'AutomaticConfiguration' = ''
'AutoSetupSetting' = ''
'Blocked' = ''
'BrowserTitle' = ''
'CustomSetupSetting' = ''
'DataSourcesSettings' = ''
'DefinesConnectionSettings' = ''
'DefinesEscOffSettings' = ''
'DefinesEscOnSettings' = ''
'DeleteChannels' = ''
'DriveMapSettings' = ''
'EscOffLocalSites' = ''
'EscOffSecurityZoneAndPrivacy' = ''
'EscOffTrustedSites' = ''
'EscOnLocalSites' = ''
'EscOnSecurityZoneAndPrivacy' = ''
'EscOnTrustedSites' = ''
'FavoriteURL' = ''
'FilesSettings' = ''
'Folder' = ''
'FolderOptions' = ''
'Folders' = ''
'General' = ''
'HomePage' = ''
'ImportedContentRatings' = ''
'InternetOptions' = ''
'LocalUsersAndGroups' = ''
'MsiApplication' = ''
'NetworkOptions' = ''
'PathRule' = ''
'PlaceFavoritesAtTop' = ''
'Policy' = ''
'PowerOptions' = ''
'PreferenceMode' = ''
'PrinterConnection' = ''
'Printers' = ''
'Programs' = ''
'ProxySettings' = ''
'RegionalOptionsSettings' = ''
'RegistrySetting' = ''
'RegistrySettings' = ''
'RestartSetupSetting' = ''
'ScheduledTasks' = ''
'Script' = ''
'SearchBar' = ''
'ShortcutSettings' = ''
'StartMenuSettings' = ''
'ToolsSetting' = ''
'TrustedPublisherLockdown' = ''
'type' = ''
}
+46
View File
@@ -0,0 +1,46 @@
function Clear-GPOZaurrSysvolDFSR {
[cmdletBinding(SupportsShouldProcess)]
param(
[alias('ForestName')][string] $Forest,
[string[]] $ExcludeDomains,
[string[]] $ExcludeDomainControllers,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[alias('DomainControllers')][string[]] $IncludeDomainControllers,
[switch] $SkipRODC,
[System.Collections.IDictionary] $ExtendedForestInformation,
[int] $LimitProcessing = [int32]::MaxValue
)
# Based on https://techcommunity.microsoft.com/t5/ask-the-directory-services-team/manually-clearing-the-conflictanddeleted-folder-in-dfsr/ba-p/395711
$StatusCodes = @{
'0' = 'Success' # MONITOR_STATUS_SUCCESS
'1' = 'Generic database error' #MONITOR_STATUS_GENERIC_DB_ERROR
'2' = 'ID record not found' # MONITOR_STATUS_IDRECORD_NOT_FOUND
'3' = 'Volume not found' # MONITOR_STATUS_VOLUME_NOT_FOUND
'4' = 'Access denied' #MONITOR_STATUS_ACCESS_DENIED
'5' = 'Generic error' #MONITOR_STATUS_GENERIC_ERROR
}
#WMIC.EXE /namespace:\\root\microsoftdfs path dfsrreplicatedfolderconfig get replicatedfolderguid, replicatedfoldername
#WMIC.EXE /namespace:\\root\microsoftdfs path dfsrreplicatedfolderinfo where "replicatedfolderguid='<RF GUID>'" call cleanupconflictdirectory
#WMIC.EXE /namespace:\\root\microsoftdfs path dfsrreplicatedfolderinfo where "replicatedfolderguid='70bebd41-d5ae-4524-b7df-4eadb89e511e'" call cleanupconflictdirectory
# https://docs.microsoft.com/en-us/previous-versions/windows/desktop/dfsr/dfsrreplicatedfolderinfo
$getGPOZaurrSysvolDFSRSplat = @{
Forest = $Forest
IncludeDomains = $IncludeDomains
ExcludeDomains = $ExcludeDomains
ExtendedForestInformation = $ExtendedForestInformation
ExcludeDomainControllers = $ExcludeDomainControllers
IncludeDomainControllers = $IncludeDomainControllers
SkipRODC = $SkipRODC
}
Get-GPOZaurrSysvolDFSR @getGPOZaurrSysvolDFSRSplat | Select-Object -First $LimitProcessing | ForEach-Object {
$Executed = Invoke-CimMethod -InputObject $_.DFSR -MethodName 'cleanupconflictdirectory' -CimSession $_.ComputerName
if ($Executed) {
[PSCustomObject] @{
Status = $StatusCodes["$($Executed.ReturnValue)"]
ComputerName = $Executed.PSComputerName
}
}
}
}
+89
View File
@@ -0,0 +1,89 @@
function ConvertFrom-CSExtension {
[cmdletBinding()]
param(
[string[]] $CSE,
[switch] $Limited
)
$GUIDs = @{
# https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-gpreg/f0dba6b8-704f-45d5-999f-1a0a694a6df9
'{35378EAC-683F-11D2-A89A-00C04FBBCFA2}' = 'Client-side extension GUID (CSE GUID)'
'{0F6B957E-509E-11D1-A7CC-0000F87571E3}' = 'Tool Extension GUID (User Policy Settings)'
'{D02B1F73-3407-48AE-BA88-E8213C6761F1}' = 'Tool Extension GUID (User Policy Settings)'
'{0F6B957D-509E-11D1-A7CC-0000F87571E3}' = 'Tool Extension GUID (Computer Policy Settings)'
'{D02B1F72-3407-48AE-BA88-E8213C6761F1}' = 'Tool Extension GUID (Computer Policy Settings)'
'{0ACDD40C-75AC-47ab-BAA0-BF6DE7E7FE63}' = 'Wireless Group Policy'
'{0E28E245-9368-4853-AD84-6DA3BA35BB75}' = 'Group Policy Environment'
'{16be69fa-4209-4250-88cb-716cf41954e0}' = 'Central Access Policy Configuration'
'{17D89FEC-5C44-4972-B12D-241CAEF74509}' = 'Group Policy Local Users and Groups'
'{1A6364EB-776B-4120-ADE1-B63A406A76B5}' = 'Group Policy Device Settings'
'{25537BA6-77A8-11D2-9B6C-0000F8080861}' = 'Folder Redirection'
'{2A8FDC61-2347-4C87-92F6-B05EB91A201A}' = 'MitigationOptions'
'{346193F5-F2FD-4DBD-860C-B88843475FD3}' = 'ConfigMgr User State Management Extension.'
'{3610eda5-77ef-11d2-8dc5-00c04fa31a66}' = 'Microsoft Disk Quota'
'{3A0DBA37-F8B2-4356-83DE-3E90BD5C261F}' = 'Group Policy Network Options'
'{426031c0-0b47-4852-b0ca-ac3d37bfcb39}' = 'QoS Packet Scheduler'
'{42B5FAAE-6536-11d2-AE5A-0000F87571E3}' = 'Scripts'
'{4bcd6cde-777b-48b6-9804-43568e23545d}' = 'Remote Desktop USB Redirection'
'{4CFB60C1-FAA6-47f1-89AA-0B18730C9FD3}' = 'Internet Explorer Zonemapping'
'{4D2F9B6F-1E52-4711-A382-6A8B1A003DE6}' = 'RADCProcessGroupPolicyEx'
'{4d968b55-cac2-4ff5-983f-0a54603781a3}' = 'Work Folders'
'{5794DAFD-BE60-433f-88A2-1A31939AC01F}' = 'Group Policy Drive Maps'
'{6232C319-91AC-4931-9385-E70C2B099F0E}' = 'Group Policy Folders'
'{6A4C88C6-C502-4f74-8F60-2CB23EDC24E2}' = 'Group Policy Network Shares'
'{7150F9BF-48AD-4da4-A49C-29EF4A8369BA}' = 'Group Policy Files'
'{728EE579-943C-4519-9EF7-AB56765798ED}' = 'Group Policy Data Sources'
'{74EE6C03-5363-4554-B161-627540339CAB}' = 'Group Policy Ini Files'
'{7933F41E-56F8-41d6-A31C-4148A711EE93}' = 'Windows Search Group Policy Extension'
'{7B849a69-220F-451E-B3FE-2CB811AF94AE}' = 'Internet Explorer User Accelerators'
'{827D319E-6EAC-11D2-A4EA-00C04F79F83A}' = 'Security'
'{8A28E2C5-8D06-49A4-A08C-632DAA493E17}' = 'Deployed Printer Connections'
'{91FBB303-0CD5-4055-BF42-E512A681B325}' = 'Group Policy Services'
'{A3F3E39B-5D83-4940-B954-28315B82F0A8}' = 'Group Policy Folder Options'
'{AADCED64-746C-4633-A97C-D61349046527}' = 'Group Policy Scheduled Tasks'
'{B087BE9D-ED37-454f-AF9C-04291E351182}' = 'Group Policy Registry'
'{B587E2B1-4D59-4e7e-AED9-22B9DF11D053}' = '802.3 Group Policy'
'{BA649533-0AAC-4E04-B9BC-4DBAE0325B12}' = 'Windows To Go Startup Options'
'{BC75B1ED-5833-4858-9BB8-CBF0B166DF9D}' = 'Group Policy Printers'
'{C34B2751-1CF4-44F5-9262-C3FC39666591}' = 'Windows To Go Hibernate Options'
'{C418DD9D-0D14-4efb-8FBF-CFE535C8FAC7}' = 'Group Policy Shortcuts'
'{C631DF4C-088F-4156-B058-4375F0853CD8}' = 'Microsoft Offline Files'
'{c6dc5466-785a-11d2-84d0-00c04fb169f7}' = 'Software Installation'
'{cdeafc3d-948d-49dd-ab12-e578ba4af7aa}' = 'TCPIP'
'{CF7639F3-ABA2-41DB-97F2-81E2C5DBFC5D}' = 'Internet Explorer Machine Accelerators'
'{e437bc1c-aa7d-11d2-a382-00c04f991e27}' = 'IP Security'
'{E47248BA-94CC-49c4-BBB5-9EB7F05183D0}' = 'Group Policy Internet Settings'
'{E4F48E54-F38D-4884-BFB9-D4D2E5729C18}' = 'Group Policy Start Menu Settings'
'{E5094040-C46C-4115-B030-04FB2E545B00}' = 'Group Policy Regional Options'
'{E62688F0-25FD-4c90-BFF5-F508B9D2E31F}' = 'Group Policy Power Options'
'{F312195E-3D9D-447A-A3F5-08DFFA24735E}' = 'ProcessVirtualizationBasedSecurityGroupPolicy'
'{f3ccc681-b74c-4060-9f26-cd84525dca2a}' = 'Audit Policy Configuration'
'{F9C77450-3A41-477E-9310-9ACD617BD9E3}' = 'Group Policy Applications'
'{FB2CA36D-0B40-4307-821B-A13B252DE56C}' = 'Enterprise QoS'
'{fbf687e6-f063-4d9f-9f4f-fd9a26acdd5f}' = 'CP'
'{FC491EF1-C4AA-4CE1-B329-414B101DB823}' = 'ProcessConfigCIPolicyGroupPolicy'
'{169EBF44-942F-4C43-87CE-13C93996EBBE}' = 'UEV Policy'
'{2BFCC077-22D2-48DE-BDE1-2F618D9B476D}' = 'AppV Policy'
'{4B7C3B0F-E993-4E06-A241-3FBE06943684}' = 'Per-process Mitigation Options'
'{7909AD9E-09EE-4247-BAB9-7029D5F0A278}' = 'MDM Policy'
'{CFF649BD-601D-4361-AD3D-0FC365DB4DB7}' = 'Delivery Optimization GP extension'
'{D76B9641-3288-4f75-942D-087DE603E3EA}' = 'AdmPwd'
'{9650FDBC-053A-4715-AD14-FC2DC65E8330}' = 'Unknown'
'{B1BE8D72-6EAC-11D2-A4EA-00C04F79F83A}' = 'EFS Recovery'
'{A2E30F80-D7DE-11d2-BBDE-00C04F86AE3B}' = 'Internet Explorer Settings'
}
foreach ($C in $CSE) {
if (-not $Limited) {
if ($GUIDs[$C]) {
[PSCustomObject] @{ Name = $C; Description = $GUIDs[$C] }
} else {
[PSCustomObject] @{ Name = $C; Description = $C }
}
} else {
if ($GUIDs[$C]) {
$GUIDs[$C]
} else {
$CSE
}
}
}
}
+21
View File
@@ -0,0 +1,21 @@
function Find-CSExtension {
[cmdletBinding()]
param(
[string[]] $CSE,
[string] $ComputerName
)
#List Group Policy Client Side Extensions, CSEs, from Windows 10
$Keys = Get-PSRegistry -RegistryPath "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions" -ComputerName $ComputerName
foreach ($Key in $Keys.PSSubKeys) {
$RegistryKey = Get-PSRegistry -RegistryPath "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions\$Key" -ComputerName $ComputerName
if ($CSE) {
foreach ($C in CSE) {
if ($RegistryKey.DefaultKey -eq $Key) {
[PSCustomObject] @{ Name = $Key; Description = $RegistryKey.DefaultKey }
}
}
} else {
[PSCustomObject] @{ CSE = $Key; Description = $RegistryKey.DefaultKey }
}
}
}
-29
View File
@@ -1,29 +0,0 @@
function Get-GPOZaurrEmptyFolders {
[cmdletBinding()]
param(
[alias('ForestName')][string] $Forest,
[string[]] $ExcludeDomains,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[System.Collections.IDictionary] $ExtendedForestInformation,
[switch] $AllFolders
)
$ForestInformation = Get-WinADForestDetails -Extended -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
foreach ($Domain in $ForestInformation.Domains) {
Get-ChildItem -Path "\\$Domain\SYSVOL\$Domain\policies" -ErrorAction SilentlyContinue -Recurse -ErrorVariable err -Force -Directory | ForEach-Object {
$FullFolder = Test-Path -Path "$($_.FullName)\*"
if (-not $FullFolder -or $AllFolders) {
[PSCustomObject] @{
FullName = $_.FullName
IsEmptyFolder = -not $FullFolder
Name = $_.Name
Root = $_.Root
Parent = $_.Parent
CreationTime = $_.CreationTime
LastWriteTime = $_.LastWriteTime
Attributes = $_.Attributes
DomainName = $Domain
}
}
}
}
}
+3
View File
@@ -50,6 +50,9 @@
"\\$Domain\NETLOGON" = @{
Name = 'NETLOGON Scripts'
}
"\\$Domain\SYSVOL\$Domain\DfsrPrivate" = @{
Name = 'DfsrPrivate'
}
"\\$Domain\SYSVOL\$Domain" = @{
Name = 'SYSVOL Root'
}
+3 -2
View File
@@ -1,4 +1,5 @@
function Get-GPOZaurrFilesPolicyDefinitions {
function Get-GPOZaurrFilesPolicyDefinition {
[alias('Get-GPOZaurrFilesPolicyDefinitions')]
[cmdletbinding()]
param(
[alias('ForestName')][string] $Forest,
@@ -55,7 +56,7 @@ function Get-GPOZaurrFilesPolicyDefinitions {
if ($FilesCache[$Domain][$FileLanguage.BaseName]) {
$FilesCache[$Domain][$FileLanguage.BaseName][$Directory.Name] = $true
} else {
#Write-Warning "Get-GPOZaurrFilesPolicyDefinitions - File $($FileLanguage.FullName) doesn't have a match."
#Write-Warning "Get-GPOZaurrFilesPolicyDefinition - File $($FileLanguage.FullName) doesn't have a match."
$Output.FilesToDelete.Add(
[PSCustomobject] @{
Name = $FileLanguage.BaseName
+140
View File
@@ -0,0 +1,140 @@
function Get-GPOZaurrFolders {
[cmdletBinding()]
param(
[ValidateSet('All', 'Netlogon', 'Sysvol')][string[]] $Type = 'All',
[ValidateSet('All', 'NTFRS', 'Empty')][string] $FolderType = 'All',
[alias('ForestName')][string] $Forest,
[string[]] $ExcludeDomains,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[System.Collections.IDictionary] $ExtendedForestInformation,
[switch] $AsHashTable
)
$ForestInformation = Get-WinADForestDetails -Extended -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
foreach ($Domain in $ForestInformation.Domains) {
$Path = @(
if ($Type -contains 'All') {
"\\$Domain\SYSVOL\$Domain"
}
if ($Type -contains 'Sysvol') {
"\\$Domain\SYSVOL\$Domain\policies"
}
if ($Type -contains 'NetLogon') {
"\\$Domain\NETLOGON"
}
)
# Order does matter
$Folders = [ordered] @{
"\\$Domain\SYSVOL\$Domain\policies\PolicyDefinitions" = @{
Name = 'SYSVOL PolicyDefinitions'
}
"\\$Domain\SYSVOL\$Domain\policies" = @{
Name = 'SYSVOL Policies'
}
"\\$Domain\SYSVOL\$Domain\scripts" = @{
Name = 'NETLOGON Scripts'
}
"\\$Domain\SYSVOL\$Domain\StarterGPOs" = @{
Name = 'SYSVOL GPO Starters'
}
"\\$Domain\NETLOGON" = @{
Name = 'NETLOGON Scripts'
}
"\\$Domain\SYSVOL\$Domain\DfsrPrivate" = @{
Name = 'DfsrPrivate'
}
"\\$Domain\SYSVOL\$Domain" = @{
Name = 'SYSVOL Root'
}
}
$Exclusions = @{
DfsrPrivate = @{
ConflictAndDeleted = $true
Deleted = $true
Installing = $true
}
'SYSVOL Policies' = @{
User = $true
Machine = $true
}
'NETLOGON Scripts' = @{
}
'SYSVOL Root' = @{
}
'SYSVOL GPO Starters' = @{
}
'SYSVOL PolicyDefinitions' = @{
}
}
Get-ChildItem -Path $Path -ErrorAction SilentlyContinue -Recurse -ErrorVariable +err -Force -Directory | ForEach-Object {
$FileType = foreach ($Key in $Folders.Keys) {
if ($_.FullName -like "$Key*") {
$Folders[$Key]
break
}
}
$RootFolder = $Folders["$($_.FullName)"]
if ($RootFolder) {
$IsRootFolder = $true
} else {
$IsRootFolder = $false
}
$IsExcluded = $Exclusions["$($FileType.Name)"]["$($_.Name)"] -is [bool]
if ($IsRootFolder -and $IsExcluded -eq $false) {
$IsExcluded = $true
}
$FullFolder = Test-Path -Path "$($_.FullName)\*"
$BrokenReplicationRoot = $_.Name -like '*_NTFRS_*'
$BrokenReplicationChild = $_.FullName -like '*_NTFRS_*' -and $_.Name -notlike '*_NTFRS_*'
$BrokenReplication = $_.FullName -like '*_NTFRS_*'
$Object = [ordered] @{
FolderType = $FileType.Name
FullName = $_.FullName
IsEmptyFolder = -not $FullFolder
IsBrokenReplication = $BrokenReplication
IsBrokenReplicationRoot = $BrokenReplicationRoot
IsBrokenReplicationChild = $BrokenReplicationChild
IsRootFolder = $IsRootFolder
IsExcluded = $IsExcluded
Name = $_.Name
Root = $_.Root
Parent = $_.Parent
CreationTime = $_.CreationTime
LastWriteTime = $_.LastWriteTime
Attributes = $_.Attributes
DomainName = $Domain
}
if (-not $Object.IsExcluded) {
if ($FolderType -eq 'Empty' -and $Object.IsEmptyFolder -eq $true) {
if ($AsHashTable) {
$Object
} else {
[PSCustomObject] $Object
}
} elseif ($FolderType -eq 'NTFRS' -and $Object.IsBrokenReplicationRoot -eq $true) {
if ($AsHashTable) {
$Object
} else {
[PSCustomObject] $Object
}
} elseif ($FolderType -eq 'All') {
if ($AsHashTable) {
$Object
} else {
[PSCustomObject] $Object
}
}
}
}
}
foreach ($e in $err) {
Write-Warning "Get-GPOZaurrFolders - $($e.Exception.Message) ($($e.CategoryInfo.Reason))"
}
}
+68
View File
@@ -0,0 +1,68 @@
function Get-GPOZaurrInheritance {
[cmdletBinding()]
param(
[switch] $IncludeBlockedObjects,
[switch] $OnlyBlockedInheritance,
[alias('ForestName')][string] $Forest,
[string[]] $ExcludeDomains,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[System.Collections.IDictionary] $ExtendedForestInformation
)
Begin {
$ForestInformation = Get-WinADForestDetails -Extended -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
}
Process {
foreach ($Domain in $ForestInformation.Domains) {
$OrganizationalUnits = Get-ADOrganizationalUnit -Filter * -Properties gpOptions, canonicalName -Server $ForestInformation['QueryServers'][$Domain]['HostName'][0]
foreach ($OU in $OrganizationalUnits) {
$InheritanceInformation = [Ordered] @{
CanonicalName = $OU.canonicalName
BlockedInheritance = if ($OU.gpOptions -eq 1) { $true } else { $false }
}
if (-not $IncludeBlockedObjects) {
if ($OnlyBlockedInheritance) {
if ($InheritanceInformation.BlockedInheritance -eq $true) {
[PSCustomObject] $InheritanceInformation
}
} else {
[PSCustomObject] $InheritanceInformation
}
} else {
if ($InheritanceInformation) {
if ($InheritanceInformation.BlockedInheritance -eq $true) {
$InheritanceInformation['UsersCount'] = $null
$InheritanceInformation['ComputersCount'] = $null
[Array] $InheritanceInformation['Users'] = (Get-ADUser -SearchBase $OU.DistinguishedName -Server $ForestInformation['QueryServers'][$Domain]['HostName'][0] -Filter *).SamAccountName
[Array] $InheritanceInformation['Computers'] = (Get-ADComputer -SearchBase $OU.DistinguishedName -Server $ForestInformation['QueryServers'][$Domain]['HostName'][0] -Filter *).SamAccountName
$InheritanceInformation['UsersCount'] = $InheritanceInformation['Users'].Count
$InheritanceInformation['ComputersCount'] = $InheritanceInformation['Computers'].Count
} else {
$InheritanceInformation['UsersCount'] = $null
$InheritanceInformation['ComputersCount'] = $null
$InheritanceInformation['Users'] = $null
$InheritanceInformation['Computers'] = $null
}
}
if ($OnlyBlockedInheritance) {
if ($InheritanceInformation.BlockedInheritance -eq $true) {
[PSCustomObject] $InheritanceInformation
}
} else {
[PSCustomObject] $InheritanceInformation
}
}
$InheritanceInformation['DistinguishedName'] = $OU.DistinguishedName
}
}
}
}
<#
$OrganizationalUnits = Get-ADOrganizationalUnit -Filter *
$Output = foreach ($OU in $OrganizationalUnits) {
Get-GPInheritance -Target $OU.DistinguishedName
}
$Output | Format-Table
#>
+41
View File
@@ -0,0 +1,41 @@
function Get-GPOZaurrSysvolDFSR {
[cmdletBinding()]
param(
[alias('ForestName')][string] $Forest,
[string[]] $ExcludeDomains,
[string[]] $ExcludeDomainControllers,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[alias('DomainControllers')][string[]] $IncludeDomainControllers,
[switch] $SkipRODC,
[System.Collections.IDictionary] $ExtendedForestInformation,
[string] $SearchDFSR = 'SYSVOL Share'
)
$ForestInformation = Get-WinADForestDetails -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExcludeDomainControllers $ExcludeDomainControllers -IncludeDomainControllers $IncludeDomainControllers -SkipRODC:$SkipRODC -ExtendedForestInformation $ExtendedForestInformation
foreach ($Domain in $ForestInformation.Domains) {
Write-Verbose "Get-GPOZaurrSysvolDFSR - Processing $Domain"
foreach ($DC in $ForestInformation.DomainDomainControllers[$Domain]) {
Write-Verbose "Get-GPOZaurrSysvolDFSR - Processing $Domain \ $($DC.HostName)"
#$QueryServer = $ForestInformation['QueryServers']["$Domain"].HostName[0]
$DFSRConfig = Get-CimInstance -Namespace 'root\microsoftdfs' -Class 'dfsrreplicatedfolderconfig' -ComputerName $($DC.HostName) | Where-Object { $_.ReplicatedFolderName -eq $SearchDFSR }
$DFSR = Get-CimInstance -Namespace 'root\microsoftdfs' -Class 'dfsrreplicatedfolderinfo' -ComputerName $($DC.HostName) | Where-Object { $_.ReplicatedFolderName -eq $SearchDFSR }
if ($DFSR -and $DFSRConfig -and ($DFSR.ReplicatedFolderGuid -eq $DFSRConfig.ReplicatedFolderGuid)) {
[PSCustomObject] @{
ComputerName = $DFSR.PSComputerName
DomainName = $Domain
ConflictPath = $DFSRConfig.ConflictPath
LastConflictCleanupTime = $DFSR.LastConflictCleanupTime
CurrentConflictSizeInMb = $DFSR.CurrentConflictSizeInMb
MaximumConflictSizeInMb = $DFSRConfig.ConflictSizeInMb
LastErrorCode = $DFSR.LastErrorCode
LastErrorMessageId = $DFSR.LastErrorMessageId
LastTombstoneCleanupTime = $DFSR.LastTombstoneCleanupTime
ReplicatedFolderGuid = $DFSR.ReplicatedFolderGuid
DFSRConfig = $DFSRConfig
DFSR = $DFSR
}
} else {
Write-Warning "Get-GPOZaurrSysvolDFSR - Couldn't process $($DC.HostName). Conditions not met."
}
}
}
}
+16 -14
View File
@@ -1,11 +1,4 @@
function Get-WMIFilter {
param(
)
}
function Get-GPOZaurrWMI {
function Get-GPOZaurrWMI {
[cmdletBinding()]
Param(
[Guid[]] $Guid,
@@ -13,10 +6,11 @@ function Get-GPOZaurrWMI {
[alias('ForestName')][string] $Forest,
[string[]] $ExcludeDomains,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[System.Collections.IDictionary] $ExtendedForestInformation
[System.Collections.IDictionary] $ExtendedForestInformation,
[switch] $AsHashtable
)
$wmiFilterAttr = "msWMI-Name", "msWMI-Parm1", "msWMI-Parm2", "msWMI-Author", "msWMI-ID", 'CanonicalName', 'Created', 'Modified'
$Dictionary = [ordered] @{}
$wmiFilterAttr = 'msWMI-Name', 'msWMI-Parm1', 'msWMI-Parm2', 'msWMI-Author', 'msWMI-ID', 'CanonicalName', 'Created', 'Modified'
$ForestInformation = Get-WinADForestDetails -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
foreach ($Domain in $ForestInformation.Domains) {
$QueryServer = $ForestInformation['QueryServers'][$Domain]['HostName'][0]
@@ -41,7 +35,7 @@ function Get-GPOZaurrWMI {
}
} else {
try {
$ldapFilter = "(objectClass=msWMI-Som)"
$ldapFilter = '(objectClass=msWMI-Som)'
Get-ADObject -LDAPFilter $ldapFilter -Properties $wmiFilterAttr -Server $QueryServer
} catch {
Write-Warning "Get-GPOZaurrWMI - Error processing WMI for $Domain`: $($_.Error.Exception)"
@@ -59,14 +53,14 @@ function Get-GPOZaurrWMI {
-join ($WMI[$i + 5], ';' , $WMI[$i + 6])
}
}
[PSCustomObject] @{
$WMIObject = [PSCustomObject] @{
DisplayName = $_.'msWMI-Name'
Description = $_.'msWMI-Parm1'
DomainName = $Domain
#NameSpace = $WMI[$i + 5]
#Query = $WMI[$i + 6]
QueryCount = $Data.Count
Query = $Data -join ","
Query = $Data -join ','
Author = $_.'msWMI-Author'
ID = $_.'msWMI-ID'
Created = $_.Created
@@ -75,9 +69,17 @@ function Get-GPOZaurrWMI {
CanonicalName = $_.CanonicalName
DistinguishedName = $_.'DistinguishedName'
}
if (-not $AsHashtable) {
$WMIObject
} else {
$Dictionary[$WMIObject.ID] = $WMIObject
}
}
}
if ($AsHashtable) {
$Dictionary
}
}
<#
CanonicalName : ad.evotec.xyz/System/WMIPolicy/SOM/{E988C890-BDBC-4946-87B5-BF70F39F4686}
+26
View File
@@ -0,0 +1,26 @@
function Get-GPOZaurrDictionary {
[cmdletBinding()]
param(
[string] $Splitter = [System.Environment]::NewLine
)
foreach ($Policy in $Script:GPODitionary.Keys) {
if ($Script:GPODitionary[$Policy].ByReports) {
[Array] $Type = foreach ($T in $Script:GPODitionary[$Policy].ByReports ) {
$T.Report
}
} else {
[Array]$Type = foreach ($T in $Script:GPODitionary[$Policy].Types) {
( -join ($T.Category, '/', $T.Settings))
}
}
[PSCustomObject] @{
Name = $Policy
Types = $Type -join $Splitter
Path = $Script:GPODitionary[$Policy].GPOPath -join $Splitter
#Details = $Script:GPODitionary[$Policy]
}
}
}
+104 -134
View File
@@ -12,9 +12,6 @@
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[string[]] $Type,
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[switch] $NoTranslation,
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
@@ -24,10 +21,12 @@
[Parameter(ParameterSetName = 'Local')]
[switch] $FullObjects,
<#
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[ValidateSet('HTML', 'Object', 'Excel')][string[]] $OutputType = 'Object',
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[string] $OutputPath,
@@ -35,6 +34,7 @@
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[switch] $Open,
#>
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
@@ -42,21 +42,21 @@
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[switch] $SingleObject
[switch] $SingleObject,
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[switch] $SkipNormalize,
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[switch] $SkipCleanup
)
if ($Type.Count -eq 0) {
$Type = $Script:GPODitionary.Keys
}
if ($GPOPath) {
if (Test-Path -LiteralPath $GPOPath) {
<#
$GPOListPath = [io.path]::Combine($GPOPath, "GPOList.xml")
if ($GPOListPath) {
$GPOs = Import-Clixml -Path $GPOListPath
} else {
}
#>
$GPOFiles = Get-ChildItem -LiteralPath $GPOPath -Recurse -File -Filter *.xml
[Array] $GPOs = foreach ($File in $GPOFiles) {
if ($File.Name -ne 'GPOList.xml') {
@@ -75,16 +75,19 @@
}
}
} else {
Write-Warning "Find-GPO - $GPOPath doesn't exists."
Write-Warning "Invoke-GPOZaurr - $GPOPath doesn't exists."
return
}
} else {
[Array] $GPOs = Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
}
# This caches single reports.
$TemporaryCachedSingleReports = [ordered] @{}
$TemporaryCachedSingleReports['ReportsSingle'] = [ordered] @{}
# This will be returned
$Output = [ordered] @{}
$OutputByGPO = [ordered] @{}
$TranslatedOutput = [ordered] @{}
$CachedCategories = [ordered] @{}
$Output['Reports'] = [ordered] @{}
$Output['CategoriesFull'] = [ordered] @{}
[Array] $GPOCategories = foreach ($GPO in $GPOs) {
if ($GPOPath) {
@@ -92,157 +95,124 @@
} else {
[xml] $GPOOutput = Get-GPOReport -Guid $GPO.GUID -Domain $GPO.DomainName -ReportType Xml
}
Get-GPOCategories -GPO $GPO -GPOOutput $GPOOutput.GPO -Splitter $Splitter -FullObjects:$FullObjects -CachedCategories $CachedCategories
Get-GPOCategories -GPO $GPO -GPOOutput $GPOOutput.GPO -Splitter $Splitter -FullObjects:$FullObjects -CachedCategories $Output['CategoriesFull']
}
# Return Categories or save it
$Output['Categories'] = $GPOCategories | Select-Object -Property * -ExcludeProperty DataSet
if ($CategoriesOnly) {
return $GPOCategories | Select-Object -Property * -ExcludeProperty DataSet
} else {
$Output['Categories'] = $GPOCategories | Select-Object -Property * -ExcludeProperty DataSet
# Return Categories only
return $Output['Categories']
}
# Save Cached Categories
$Output['CategoriesFull'] = $CachedCategories
# Process Reporting
$Output['Reports'] = [ordered] @{}
if ($CachedCategories.Count -gt 0) {
# We check our dictionary for reports that are based on reports to make sure we run CodeSingle separatly
[Array] $FindRequiredSingle = foreach ($Key in $Script:GPODitionary.Keys) {
$Script:GPODitionary[$Key].ByReports.Report
}
# Build reports based on categories
if ($Output['CategoriesFull'].Count -gt 0) {
foreach ($Report in $Type) {
foreach ($CategoryType in $Script:GPODitionary[$Report].Types) {
$Category = $CategoryType.Category
$Settings = $CategoryType.Settings
# Those are checks for making sure we have data to be even able to process it
if (-not $CachedCategories[$Category]) {
if (-not $Output['CategoriesFull'][$Category]) {
continue
}
if (-not $CachedCategories[$Category][$Settings]) {
if (-not $Output['CategoriesFull'][$Category][$Settings]) {
continue
}
# Translation
$CategorizedGPO = $CachedCategories[$Category][$Settings]
$CategorizedGPO = $Output['CategoriesFull'][$Category][$Settings]
foreach ($GPO in $CategorizedGPO) {
if (-not $Output['Reports'][$Report]) {
$Output['Reports'][$Report] = [System.Collections.Generic.List[PSCustomObject]]::new()
}
# Create temporary storage for "single gpo" reports
# it's required if we want to base reports on other reports later on
if (-not $TemporaryCachedSingleReports['ReportsSingle'][$Report]) {
$TemporaryCachedSingleReports['ReportsSingle'][$Report] = [System.Collections.Generic.List[PSCustomObject]]::new()
}
# Make sure translated gpo is null
$TranslatedGpo = $null
if ($SingleObject) {
if ($SingleObject -or ($Report -in $FindRequiredSingle)) {
# We either create 1 GPO with multiple settings to return it as user requested it
# Or we process it only because we need to base it for reports based on other reports
if (-not $Script:GPODitionary[$Report]['CodeSingle']) {
# sometimes code and code single are identical. To not define things two times, one can just skip it
If ($Script:GPODitionary[$Report]['Code']) {
$Script:GPODitionary[$Report]['CodeSingle'] = $Script:GPODitionary[$Report]['Code']
}
}
if ($Script:GPODitionary[$Report]['CodeSingle']) {
$TranslatedGpo = Invoke-Command -ScriptBlock $Script:GPODitionary[$Report]['CodeSingle']
}
} else {
if ($Script:GPODitionary[$Report]['Code']) {
$TranslatedGpo = Invoke-Command -ScriptBlock $Script:GPODitionary[$Report]['Code']
}
}
foreach ($T in $TranslatedGpo) {
$Output['Reports'][$Report].Add($T)
}
}
}
}
}
return $Output
<#
foreach ($GPO in $GPOs) {
if ($GPOPath) {
$GPOOutput = $GPO.GPOOutput
} else {
[xml] $GPOOutput = Get-GPOReport -Guid $GPO.GUID -Domain $GPO.DomainName -ReportType Xml
}
[Array] $Data = Get-XMLStandard -GPO $GPO -GPOOutput $GPOOutput.GPO -Splitter $Splitter -FullObjects:$FullObjects
foreach ($D in $Data) {
if (-not $Output["$($D.GpoCategory)"]) {
$Output["$($D.GpoCategory)"] = [ordered] @{}
}
if (-not $Output["$($D.GpoCategory)"]["$($D.GpoSettings)"]) {
$Output["$($D.GpoCategory)"]["$($D.GpoSettings)"] = [System.Collections.Generic.List[PSCustomObject]]::new()
}
$Output["$($D.GpoCategory)"]["$($D.GpoSettings)"].Add($D)
if (-not $OutputByGPO["$($D.DomainName)"]) {
$OutputByGPO["$($D.DomainName)"] = [ordered] @{}
}
if (-not $OutputByGPO[$D.DomainName][$D.DisplayName]) {
$OutputByGPO[$D.DomainName][$D.DisplayName] = [System.Collections.Generic.List[PSCustomObject]]::new()
}
$OutputByGPO[$D.DomainName][$D.DisplayName].Add($D)
}
}
if ($NoTranslation) {
if ($OutputType -contains 'Object') {
$Output
}
} else {
foreach ($Report in $Type) {
$Category = $Script:GPODitionary[$Report]['Category']
$Settings = $Script:GPODitionary[$Report]['Settings']
$TranslatedOutput[$Report] = Invoke-GPOTranslation -InputData $Output -Category $Category -Settings $Settings -Report $Report
}
if ($OutputType -contains 'Object') {
$TranslatedOutput
}
}
if ($NoTranslation) {
$SingleSource = $Output
} else {
$SingleSource = $TranslatedOutput
}
if ($OutputPath) {
$FolderPath = $OutputPath
} else {
$FolderPath = [io.path]::GetTempPath()
}
if ($OutputType -contains 'HTML') {
$FilePathHTML = [io.path]::Combine($FolderPath, "GPOZaurr-Summary-$((Get-Date).ToString('yyyy-MM-dd_HH_mm_ss')).html")
Write-Warning "Invoke-GPOZaurr - $FilePathHTML"
New-HTML {
foreach ($GPOCategory in $SingleSource.Keys) {
New-HTMLTab -Name $GPOCategory {
if ($SingleSource["$GPOCategory"] -is [System.Collections.IDictionary]) {
foreach ($GpoSettings in $SingleSource["$GPOCategory"].Keys) {
New-HTMLTab -Name $GpoSettings {
if ($SingleSource[$GPOCategory][$GpoSettings].Count -gt 0) {
New-HTMLTable -DataTable $SingleSource[$GPOCategory][$GpoSettings] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
if ($Report -in $FindRequiredSingle) {
foreach ($T in $TranslatedGpo) {
$TemporaryCachedSingleReports['ReportsSingle'][$Report].Add($T)
}
}
if ($SingleObject) {
foreach ($T in $TranslatedGpo) {
$Output['Reports'][$Report].Add($T)
}
}
}
} else {
if ($SingleSource[$GPOCategory].Count -gt 0) {
New-HTMLTable -DataTable $SingleSource[$GPOCategory] -ScrollX -DisablePaging -AllProperties -Title $GpoSettings
}
if (-not $SingleObject) {
# We want each GPO to be listed multiple times if it makes sense for reporting
# think drive mapping - showing 1 mapping of a drive per object even if there are 50 drive mappings within 1 gpo
# this would result in 50 objects created
if ($Script:GPODitionary[$Report]['Code']) {
$TranslatedGpo = Invoke-Command -ScriptBlock $Script:GPODitionary[$Report]['Code']
foreach ($T in $TranslatedGpo) {
$Output['Reports'][$Report].Add($T)
}
}
}
}
}
} -Online -ShowHTML:$Open.IsPresent -FilePath $FilePathHTML
}
}
if ($OutputType -contains 'Excel') {
$FilePathExcel = [io.path]::Combine($FolderPath, "GPOZaurr-Summary-$((Get-Date).ToString('yyyy-MM-dd_HH_mm_ss')).xlsx")
Write-Warning "Invoke-GPOZaurr - $FilePathExcel"
foreach ($GPOCategory in $SingleSource.Keys) {
if ($SingleSource["$GPOCategory"] -is [System.Collections.IDictionary]) {
foreach ($GpoSettings in $SingleSource["$GPOCategory"].Keys) {
if ($SingleSource[$GPOCategory][$GpoSettings].Count -gt 0) {
ConvertTo-Excel -DataTable $SingleSource[$GPOCategory][$GpoSettings] -AllProperties -ExcelWorkSheetName $GpoSettings -FilePath $FilePathExcel -AutoFilter -AutoFit -Option Rename
}
}
} else {
if ($SingleSource[$GPOCategory].Count -gt 0) {
ConvertTo-Excel -DataTable $SingleSource[$GPOCategory] -AllProperties -ExcelWorkSheetName $GPOCategory -FilePath $FilePathExcel -AutoFilter -AutoFit -Option Rename
# Those reports are based on other reports (for example already processed registry settings)
# This is useful where going thru registry collections may not be efficient enough to try and read it directly again
foreach ($Report in $Type) {
foreach ($ReportType in $Script:GPODitionary[$Report].ByReports) {
if (-not $Output['Reports'][$Report]) {
$Output['Reports'][$Report] = [System.Collections.Generic.List[PSCustomObject]]::new()
}
$FindReport = $ReportType.Report
foreach ($GPO in $TemporaryCachedSingleReports['ReportsSingle'][$FindReport]) {
$TranslatedGpo = Invoke-Command -ScriptBlock $Script:GPODitionary[$Report]['CodeReport']
foreach ($T in $TranslatedGpo) {
$Output['Reports'][$Report].Add($T)
}
}
}
if ($Open) {
Invoke-Item -Path $FilePathExcel
}
# Normalize - meaning that before we return each GPO report we make sure that each entry has the same column names regardless which one is first.
# Normally if you would have a GPO with just 2 entries for given subject (say LAPS), and then another GPO having 5 settings for the same type
# and you would display them one after another - all entries would be shown using first object which has less properties then 2nd or 3rd object
# to make sure all objects are having same (even empty) properties we "normalize" it
if (-not $SkipNormalize) {
foreach ($Report in [string[]] $Output['Reports'].Keys) {
$FirstProperties = 'DisplayName', 'DomainName', 'GUID', 'GpoType'
$EndProperties = 'CreatedTime', 'ModifiedTime', 'ReadTime', 'Filters', 'Linked', 'LinksCount', 'Links'
$Properties = $Output['Reports'][$Report] | Select-Properties -ExcludeProperty ($FirstProperties + $EndProperties) -AllProperties -WarningAction SilentlyContinue
$DisplayProperties = @(
$FirstProperties
foreach ($Property in $Properties) {
$Property
}
$EndProperties
)
$Output['Reports'][$Report] = $Output['Reports'][$Report] | Select-Object -Property $DisplayProperties
}
}
#>
$Output['PoliciesTotal'] = $Output.Reports.Policies.PolicyCategory | Group-Object | Select-Object Name, Count | Sort-Object -Property Name #-Descending
#$Output['PoliciesTotal'] = $Output.Reports.Policies.PolicyCategory | Group-Object | Select-Object Name, Count | Sort-Object -Property Count -Descending
if (-not $SkipCleanup) {
Remove-EmptyValue -Hashtable $Output -Recursive
}
return $Output
}
[scriptblock] $SourcesAutoCompleter = {
@@ -250,4 +220,4 @@
$Script:GPODitionary.Keys | Sort-Object | Where-Object { $_ -like "*$wordToComplete*" }
}
Register-ArgumentCompleter -CommandName Find-GPO -ParameterName Type -ScriptBlock $SourcesAutoCompleter
Register-ArgumentCompleter -CommandName Invoke-GPOZaurr -ParameterName Type -ScriptBlock $SourcesAutoCompleter
+112
View File
@@ -0,0 +1,112 @@
function Invoke-GPOZaurrSupport {
[cmdletBinding()]
param(
[ValidateSet('NativeHTML', 'HTML', 'XML', 'Object')][string] $Type = 'HTML',
[alias('Server')][string] $ComputerName,
[alias('User')][string] $UserName,
[string] $Path,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $PreventShow,
[switch] $Offline
)
# if user didn't choose anything, lets run as currently logged in user locally
if (-not $UserName -and -not $ComputerName) {
$UserName = $Env:USERNAME
# we can also check if the session is Administrative and if so request computer policies
if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
$ComputerName = $Env:COMPUTERNAME
}
}
If ($Type -eq 'HTML') {
$Exists = Get-Command -Name 'New-HTML' -ErrorAction SilentlyContinue
if (-not $Exists) {
Write-Warning "Request-GPOZaurr - PSWriteHTML module is required for HTML functionality. Use XML, Object or NativeHTML option instead."
return
}
}
$SplatPolicy = @{}
if ($Type -in 'Object', 'XML', 'HTML') {
if ($Path) {
$SplatPolicy['Path'] = $Path
} else {
$SplatPolicy['Path'] = [io.path]::GetTempFileName().Replace('.tmp', ".xml")
}
$SplatPolicy['ReportType'] = 'xml'
} elseif ($Type -eq 'NativeHTML') {
if ($Path) {
$SplatPolicy['Path'] = $Path
} else {
$SplatPolicy['Path'] = [io.path]::GetTempFileName().Replace('.tmp', ".html")
}
$SplatPolicy['ReportType'] = 'html'
}
if ($ComputerName) {
$SplatPolicy['Computer'] = $ComputerName
}
if ($UserName) {
$SplatPolicy['User'] = $UserName
}
try {
#Write-Verbose "Request-GPOZaurr - ComputerName: $($SplatPolicy['Computer']) UserName: $($SplatPolicy['User'])"
$ResultantSetPolicy = Get-GPResultantSetOfPolicy @SplatPolicy -ErrorAction Stop
} catch {
if ($_.Exception.Message -eq 'Exception from HRESULT: 0x80041003') {
Write-Warning "Request-GPOZaurr - Are you running as admin? $($_.Exception.Message)"
return
} else {
$ErrorMessage = $($_.Exception.Message).Replace([Environment]::NewLine, ' ')
Write-Warning "Request-GPOZaurr - Error: $ErrorMessage"
return
}
}
if ($Type -eq 'NativeHTML') {
if (-not $PreventShow) {
Write-Verbose "Invoke-GPOZaurrSupport - Opening up file $SplatPolicy['Path']"
Start-Process -FilePath $SplatPolicy['Path']
}
return
}
# Loads created XML by resultant Output
if ($SplatPolicy.Path -and (Test-Path -LiteralPath $SplatPolicy.Path)) {
[xml] $PolicyContent = Get-Content -LiteralPath $SplatPolicy.Path
if ($PolicyContent) {
# lets remove temporary XML file
Remove-Item -LiteralPath $SplatPolicy.Path
} else {
Write-Warning "Request-GPOZaurr - Couldn't load XML file from drive $($SplatPolicy.Path). Terminating."
return
}
} else {
Write-Warning "Request-GPOZaurr - Couldn't find XML file on drive $($SplatPolicy.Path). Terminating."
return
}
if ($ComputerName) {
if (-not $PolicyContent.Rsop.'ComputerResults'.EventsDetails) {
Write-Warning "Request-GPOZaurr - Windows Events for Group Policy are missing. Amount of data will be limited. Firewall issue?"
}
}
if ($Type -eq 'XML') {
$PolicyContent.Rsop
} else {
$Output = [ordered] @{
ResultantSetPolicy = $ResultantSetPolicy
}
if ($PolicyContent.Rsop.ComputerResults) {
$Output.ComputerResults = ConvertFrom-XMLRSOP -Content $PolicyContent.Rsop -ResultantSetPolicy $ResultantSetPolicy -ResultsType 'ComputerResults' -Splitter $Splitter
}
if ($PolicyContent.Rsop.UserResults) {
$Output.UserResults = ConvertFrom-XMLRSOP -Content $PolicyContent.Rsop -ResultantSetPolicy $ResultantSetPolicy -ResultsType 'UserResults' -Splitter $Splitter
}
New-GPOZaurrReportConsole -Results $Output
if ($Type -contains 'Object') {
$Output
} elseif ($Type -contains 'HTML') {
New-GPOZaurrReportHTML -Path $Path -Offline:$Offline -Open:(-not $PreventShow) -Support $Output
}
}
}
-25
View File
@@ -1,25 +0,0 @@
function Remove-GPOZaurrEmptyFolders {
[cmdletBinding(SupportsShouldProcess)]
param(
[ValidateSet('Adm')][string] $Folders,
[int] $LimitProcessing = [int32]::MaxValue,
[alias('ForestName')][string] $Forest,
[string[]] $ExcludeDomains,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[System.Collections.IDictionary] $ExtendedForestInformation
)
Get-GPOZaurrEmptyFolders -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation | Where-Object {
foreach ($Folder in $Folders) {
if ($_.IsEmptyFolder -eq $true -and $_.Name -eq $Folder) {
$_
}
}
} | Select-Object | Select-Object -First $LimitProcessing | ForEach-Object {
try {
Write-Verbose "Remove-GPOZaurrEmptyFolders - Removing $($_.FullName)"
Remove-Item -Path $_.FullName
} catch {
Write-Warning "Remove-GPOZaurrEmptyFolders - Failed to remove directory $($_.FullName): $($_.Exception.Message)."
}
}
}
+62
View File
@@ -0,0 +1,62 @@
function Remove-GPOZaurrFolders {
[cmdletBinding(SupportsShouldProcess)]
param(
[string] $BackupPath,
[switch] $BackupDated,
[ValidateSet('All', 'Netlogon', 'Sysvol')][string[]] $Type = 'All',
[Parameter(Mandatory)][ValidateSet('NTFRS', 'Empty')][string] $FolderType,
[string[]] $FolderName,
[int] $LimitProcessing = [int32]::MaxValue,
[alias('ForestName')][string] $Forest,
[string[]] $ExcludeDomains,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[System.Collections.IDictionary] $ExtendedForestInformation
)
if ($BackupPath) {
if ($BackupDated) {
$BackupFinalPath = "$BackupPath\$((Get-Date).ToString('yyyy-MM-dd_HH_mm_ss'))"
} else {
$BackupFinalPath = $BackupPath
}
} else {
$BackupFinalPath = ''
}
Get-GPOZaurrFolders -Type $Type -FolderType $FolderType -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation | Where-Object {
if ($FolderName) {
foreach ($Folder in $FolderName) {
if ($_.Name -eq $Folder) {
$_
}
}
} else {
$_
}
} | Select-Object | Select-Object -First $LimitProcessing | ForEach-Object {
if ($BackupFinalPath) {
$SYSVOLRoot = "\\$($_.DomainName)\SYSVOL\$($_.DomainName)\"
$DestinationFile = ($_.FullName).Replace($SYSVOLRoot, '')
#$DestinationMissingFolder = $DestinationFile.Replace($DestinationFile, '')
$DestinationFilePath = [system.io.path]::Combine($BackupFinalPath, $DestinationFile)
#$DestinationFolderPath = [system.io.path]::Combine($BackupFinalPath, $DestinationMissingFolder)
Write-Verbose "Remove-GPOZaurrFolders - Backing up $($_.FullName)"
Try {
Copy-Item -LiteralPath $_.FullName -Recurse -Destination $DestinationFilePath -ErrorAction Stop -Force
$BackupWorked = $true
} catch {
Write-Warning "Remove-GPOZaurrFolders - Error backing up error: $($_.Exception.Message)"
$BackupWorked = $false
}
}
if ($BackupWorked -or $BackupFinalPath -eq '') {
try {
Write-Verbose "Remove-GPOZaurrFolders - Removing $($_.FullName)"
Remove-Item -Path $_.FullName -Force -Recurse
} catch {
Write-Warning "Remove-GPOZaurrFolders - Failed to remove directory $($_.FullName): $($_.Exception.Message)."
}
}
}
}
-22
View File
@@ -1,22 +0,0 @@
function Select-GPOTranslation {
[cmdletbInding()]
param(
[Parameter(ValueFromPipeline)][System.Collections.IDictionary] $InputObject,
[string] $Category,
[string] $Settings
)
$Important = [ordered] @{}
$AllProperties = Select-Properties -AllProperties -Objects $InputObject.$Category.$Settings
$MissingProperties = $AllProperties | Where-Object { $_ -notin 'DisplayName', 'DomainName', 'GUID', 'Linked', 'LinksCount', 'Links', 'GPOType', 'GPOCategory', 'GPOSettings' }
$Types = foreach ($Property in $MissingProperties) {
($InputObject.$Category.$Settings | Where-Object { $null -ne $_.$Property }).$Property | ForEach-Object {
($_ | Get-Member -MemberType Properties) | Where-Object { $_.Name -notin 'Length' }
}
}
$Important['AllProperties'] = $AllProperties
$Important['MissingProperties'] = $MissingProperties
$Important['Types'] = $Types | Select-Object -Unique
$Important['Data'] = $InputObject.$Category.$Settings
$Important
}
+30 -1
View File
@@ -21,6 +21,16 @@
## To install
GPOZaurr requires `RSAT` installed to provide results. If you don't have them you can install them as below. Keep in mind it also installs GUI tools so it shouldn't be installed on user workstations.
```powershell
# Windows 10 Latest
Add-WindowsCapability -Online -Name 'Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0'
Add-WindowsCapability -Online -Name 'Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0'
```
Finally just install module:
```powershell
Install-Module -Name GPOZaurr -AllowClobber -Force
```
@@ -39,8 +49,27 @@ That's it. Whenever there's a new version, you run the command, and you can enjo
## Changelog
- 0.0.55 - 17.08.2020
- Improved `Get-GPOZaurrInheritance`
- 0.0.54 - 16.08.2020
- Added `Invoke-GPOZaurrSupport` (WIP)
- Added `ConvertFrom-CSExtension`
- Added `Find-CSExtension`
- Added `Get-GPOZaurrInheritance`
- 0.0.53 - 16.08.2020
- Bad release
- 0.0.52 - 16.08.2020
- Bad release
- 0.0.51 - 2.08.2020
- Updates to `Invoke-GPOZaurr` - still work in progress
- Added `Get-GPOZaurrSysvolDFSR`
- Added `Clear-GPOZaurrSysvolDFSR` (requires testing)
- 0.0.50 - 29.07.2020
- Updates to couple of commands
- 0.0.49 - 23.07.2020
- Hidden files were skipped - and people do crazy things with them
- 0.0.48 - 21.07.2020
- Added `Get-GPOZaurrFilesPolicyDefinitions`
- Added `Get-GPOZaurrFilesPolicyDefinition`
- Updates to `Invoke-GPOZaurr` - still work in progress
- Updates to `Get-GPOZaurrFiles` - still work in progress
- Updates to `Remove-GPOZaurrOrphanedSysvolFolders` with backup and support for domains