diff --git a/Private/Invoke.GPOZaurrNetLogonPermissions.ps1 b/Private/Invoke.GPOZaurrNetLogonPermissions.ps1 index f7e9086..7c619dc 100644 --- a/Private/Invoke.GPOZaurrNetLogonPermissions.ps1 +++ b/Private/Invoke.GPOZaurrNetLogonPermissions.ps1 @@ -1,13 +1,11 @@ $GPOZaurrNetLogonPermissions = [ordered] @{ - Name = 'NetLogon Permissions' - Enabled = $true - Data = $null - DataOwner = [System.Collections.Generic.List[PSCustomObject]]::new() - DataNonOwner = [System.Collections.Generic.List[PSCustomObject]]::new() - Execute = { + Name = 'NetLogon Permissions' + Enabled = $true + Data = $null + Execute = { Get-GPOZaurrNetLogon } - Processing = { + Processing = { foreach ($File in $GPOZaurrNetLogonPermissions['Data']) { if ($File.FileSystemRights -eq 'Owner') { $GPOZaurrNetLogonPermissions['Variables']['NetLogonOwners']++ @@ -26,21 +24,23 @@ } else { $GPOZaurrNetLogonPermissions['Variables']['NetLogonOwnersToFix']++ } - $GPOZaurrNetLogonPermissions['DataOwner'].Add($File) + $GPOZaurrNetLogonPermissions['Variables']['Owner'].Add($File) } else { - $GPOZaurrNetLogonPermissions['DataNonOwner'].Add($File) + $GPOZaurrNetLogonPermissions['Variables']['NonOwner'].Add($File) } } } - Variables = @{ + Variables = @{ NetLogonOwners = 0 NetLogonOwnersAdministrators = 0 NetLogonOwnersNotAdministrative = 0 NetLogonOwnersAdministrative = 0 NetLogonOwnersAdministrativeNotAdministrators = 0 NetLogonOwnersToFix = 0 + Owner = [System.Collections.Generic.List[PSCustomObject]]::new() + NonOwner = [System.Collections.Generic.List[PSCustomObject]]::new() } - Overview = { + Overview = { New-HTMLPanel { New-HTMLText -Text 'Following chart presents ', 'NetLogon Summary' -FontSize 10pt -FontWeight normal, bold New-HTMLList -Type Unordered { @@ -63,7 +63,7 @@ } } - Solution = { + Solution = { New-HTMLTab -Name 'NetLogon Owners' { New-HTMLSection -Invisible { New-HTMLPanel { @@ -92,7 +92,7 @@ } } New-HTMLSection -Name 'NetLogon Files List' { - New-HTMLTable -DataTable $GPOZaurrNetLogonPermissions['DataOwner'] -Filtering { + New-HTMLTable -DataTable $GPOZaurrNetLogonPermissions['Variables']['Owner'] -Filtering { New-HTMLTableCondition -Name 'PrincipalSid' -Value "S-1-5-32-544" -BackgroundColor LightGreen -ComparisonType string New-HTMLTableCondition -Name 'PrincipalSid' -Value "S-1-5-32-544" -BackgroundColor Salmon -ComparisonType string -Operator ne New-HTMLTableCondition -Name 'PrincipalType' -Value "WellKnownAdministrative" -BackgroundColor LightGreen -ComparisonType string -Operator eq @@ -161,7 +161,7 @@ } New-HTMLTab -Name 'NetLogon Permissions' { New-HTMLSection -Name 'NetLogon Files List' { - New-HTMLTable -DataTable $GPOZaurrNetLogonPermissions['DataNonOwner'] -Filtering + New-HTMLTable -DataTable $GPOZaurrNetLogonPermissions['Variables']['NonOwner'] -Filtering } } } diff --git a/Private/Script.GPOConfiguration.ps1 b/Private/Script.GPOConfiguration.ps1 index 56eb300..f7977d7 100644 --- a/Private/Script.GPOConfiguration.ps1 +++ b/Private/Script.GPOConfiguration.ps1 @@ -1,8 +1,8 @@ -$Script:GPOConfiguration = @{ - GPOConsistency = $GPOZaurrConsistency - GPOOwners = $GPOZaurrOwners - GPOList = $GPOZaurrList +$Script:GPOConfiguration = [ordered] @{ GPOOrphans = $GPOZaurrOrphans + GPOOwners = $GPOZaurrOwners + GPOConsistency = $GPOZaurrConsistency + GPOList = $GPOZaurrList GPOPermissions = $GPOZaurrPermissions GPOPermissionsRoot = $GPOZaurrPermissionsRoot GPOFiles = $GPOZaurrFiles diff --git a/Public/Invoke-GPOZaurr.ps1 b/Public/Invoke-GPOZaurr.ps1 index eb5a631..d641b62 100644 --- a/Public/Invoke-GPOZaurr.ps1 +++ b/Public/Invoke-GPOZaurr.ps1 @@ -24,15 +24,33 @@ $LatestVersion = $GitHubReleases[0] if (-not $LatestVersion.Errors) { if ($GPOZaurrVersion.Version -eq $LatestVersion.Version) { - $Script:Reporting['Version'] = "GPOZaurr Current/Latest: $($LatestVersion.Version) at $($LatestVersion.PublishDate)" + $Script:Reporting['Version'] = "Current/Latest: $($LatestVersion.Version) at $($LatestVersion.PublishDate)" } elseif ($GPOZaurrVersion.Version -lt $LatestVersion.Version) { - $Script:Reporting['Version'] = "GPOZaurr Current: $($GPOZaurrVersion.Version), Published: $($LatestVersion.Version) at $($LatestVersion.PublishDate). Update?" + $Script:Reporting['Version'] = "Current: $($GPOZaurrVersion.Version), Published: $($LatestVersion.Version) at $($LatestVersion.PublishDate). Update?" } elseif ($GPOZaurrVersion.Version -gt $LatestVersion.Version) { - $Script:Reporting['Version'] = "GPOZaurr Current: $($GPOZaurrVersion.Version), Published: $($LatestVersion.Version) at $($LatestVersion.PublishDate). Lucky you!" + $Script:Reporting['Version'] = "Current: $($GPOZaurrVersion.Version), Published: $($LatestVersion.Version) at $($LatestVersion.PublishDate). Lucky you!" } } else { $Script:Reporting['Version'] = "GPOZaurr Current: $($GPOZaurrVersion.Version)" } + Write-Color '[i]', "[GPOZaurr] ", 'Version', ' [Informative] ', $Script:Reporting['Version'] -Color Yellow, DarkGray, Yellow, DarkGray, Magenta + + $Supported = [System.Collections.Generic.List[string]]::new() + [Array] $NotSupported = foreach ($T in $Type) { + if ($T -notin $Script:GPOConfiguration.Keys ) { + $T + } else { + $Supported.Add($T) + } + } + if ($Supported) { + Write-Color '[i]', "[GPOZaurr] ", 'Supported types', ' [Informative] ', "Chosen by user: ", ($Supported -join ', ') -Color Yellow, DarkGray, Yellow, DarkGray, Yellow, Magenta + } + if ($NotSupported) { + Write-Color '[i]', "[GPOZaurr] ", 'Not supported types', ' [Informative] ', "Following types are not supported: ", ($NotSupported -join ', ') -Color Yellow, DarkGray, Yellow, DarkGray, Yellow, Magenta + Write-Color '[i]', "[GPOZaurr] ", 'Not supported types', ' [Informative] ', "Please use one/multiple from the list: ", ($Script:GPOConfiguration.Keys -join ', ') -Color Yellow, DarkGray, Yellow, DarkGray, Yellow, Magenta + return + } # Lets disable all current ones foreach ($T in $Script:GPOConfiguration.Keys) {