From e04f5514f82c68049f0205e1f2e4d208df0840ea Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Fri, 15 May 2020 13:31:13 +0200 Subject: [PATCH] Cleanup dead code --- Public/Get-GPOZaurrPermissionConsistency.ps1 | 116 ------------------- 1 file changed, 116 deletions(-) diff --git a/Public/Get-GPOZaurrPermissionConsistency.ps1 b/Public/Get-GPOZaurrPermissionConsistency.ps1 index 5ef2f7e..973d8a8 100644 --- a/Public/Get-GPOZaurrPermissionConsistency.ps1 +++ b/Public/Get-GPOZaurrPermissionConsistency.ps1 @@ -90,122 +90,6 @@ } [PSCustomObject] $Object } - <# - } elseif ($GPOGuid) { - Get-GPO -Guid $GPOGuid -Domain $Domain -Server $QueryServer -ErrorAction SilentlyContinue | ForEach-Object -Process { - try { - $IsConsistent = $_.IsAclConsistent() - $ErrorMessage = '' - } catch { - $ErrorMessage = $_.Exception.Message - Write-Warning "Get-GPOZaurrPermissionConsistency - Failed to get consistency: $($_.Exception.Message)." - $IsConsistent = 'Not available.' - } - $SysVolpath = -join ('\\', $Domain, '\sysvol\', $Domain, '\Policies\{', $_.ID.GUID, '}') - if ($Advanced) { - $FolderPermissions = Get-WinADSharePermission -Path $SysVolpath - [Array] $NotInheritedPermissions = foreach ($File in $FolderPermissions) { - if ($File.Path -ne $SysVolpath -and $File.IsInherited -eq $false) { - $File - } - } - if ($NotInheritedPermissions.Count -eq 0) { - $ACLConsistentInside = $true - } else { - $ACLConsistentInside = $false - } - } else { - $ACLConsistentInside = $null - } - $Object = [ordered] @{ - DisplayName = $_.DisplayName # : New Group Policy Object - DomainName = $_.DomainName # : ad.evotec.xyz - ACLConsistent = $IsConsistent - ACLConsistentInside = $ACLConsistentInside - Owner = $_.Owner # : EVOTEC\Enterprise Admins - Path = $_.Path - SysVolPath = $SysvolPath - Id = $_.Id # : 8a7bc515-d7fd-4d1f-90b8-e47c15f89295 - GpoStatus = $_.GpoStatus # : AllSettingsEnabled - Description = $_.Description # : - CreationTime = $_.CreationTime # : 04.03.2020 17:19:42 - ModificationTime = $_.ModificationTime# : 06.05.2020 10:30:36 - UserVersion = $_.UserVersion # : AD Version: 0, SysVol Version: 0 - ComputerVersion = $_.ComputerVersion # : AD Version: 1, SysVol Version: 1 - WmiFilter = $_.WmiFilter # : - Error = $ErrorMessage - } - if ($Advanced) { - $Object['ACLConsistentInsideDetails'] = $NotInheritedPermissions - } - if ($IncludeGPOObject) { - $Object['IncludeGPOObject'] = $_ - } - [PSCustomObject] $Object - } - } else { - Get-GPO -All -Domain $Domain -Server $QueryServer | ForEach-Object -Process { - try { - $IsConsistent = $_.IsAclConsistent() - $ErrorMessage = '' - } catch { - $ErrorMessage = $_.Exception.Message - Write-Warning "Get-GPOZaurrPermissionConsistency - Failed to get consistency: $($_.Exception.Message)." - $IsConsistent = 'Not available.' - } - if ($Type -eq 'Consistent') { - if (-not $IsConsistent) { - return - } - } elseif ($Type -eq 'Inconsistent') { - if ($IsConsistent -eq $true) { - return - } - } - $SysVolpath = -join ('\\', $Domain, '\sysvol\', $Domain, '\Policies\{', $_.ID.GUID, '}') - if ($Advanced) { - $FolderPermissions = Get-WinADSharePermission -Path $SysVolpath - [Array] $NotInheritedPermissions = foreach ($File in $FolderPermissions) { - if ($File.Path -ne $SysVolpath -and $File.IsInherited -eq $false) { - $File - } - } - if ($NotInheritedPermissions.Count -eq 0) { - $ACLConsistentInside = $true - } else { - $ACLConsistentInside = $false - } - } else { - $ACLConsistentInside = $null - } - $Object = [ordered] @{ - DisplayName = $_.DisplayName # : New Group Policy Object - DomainName = $_.DomainName # : ad.evotec.xyz - ACLConsistent = $IsConsistent - ACLConsistentInside = $ACLConsistentInside - Owner = $_.Owner # : EVOTEC\Enterprise Admins - Path = $_.Path - SysVolPath = $SysvolPath - Id = $_.Id # : 8a7bc515-d7fd-4d1f-90b8-e47c15f89295 - GpoStatus = $_.GpoStatus # : AllSettingsEnabled - Description = $_.Description # : - CreationTime = $_.CreationTime # : 04.03.2020 17:19:42 - ModificationTime = $_.ModificationTime# : 06.05.2020 10:30:36 - UserVersion = $_.UserVersion # : AD Version: 0, SysVol Version: 0 - ComputerVersion = $_.ComputerVersion # : AD Version: 1, SysVol Version: 1 - WmiFilter = $_.WmiFilter # : - Error = $ErrorMessage - } - if ($Advanced) { - $Object['ACLConsistentInsideDetails'] = $NotInheritedPermissions - } - if ($IncludeGPOObject) { - $Object['IncludeGPOObject'] = $_ - } - [PSCustomObject] $Object - } - } - #> } } End {