mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-09-03 22:25:22 +00:00
Cleanup dead code
This commit is contained in:
@@ -90,122 +90,6 @@
|
|||||||
}
|
}
|
||||||
[PSCustomObject] $Object
|
[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 {
|
End {
|
||||||
|
|||||||
Reference in New Issue
Block a user