diff --git a/Public/Get-GPOZaurrPermissionConsistency.ps1 b/Public/Get-GPOZaurrPermissionConsistency.ps1 index 6f7d59f..5b81f34 100644 --- a/Public/Get-GPOZaurrPermissionConsistency.ps1 +++ b/Public/Get-GPOZaurrPermissionConsistency.ps1 @@ -47,15 +47,20 @@ $GPO = $_ $Count++ Write-Verbose "Get-GPOZaurrPermissionConsistency - Processing [$($_.DomainName)]($Count/$($GroupPolicies.Count)) $($_.DisplayName)" - try { - $IsConsistent = $_.IsAclConsistent() - $ErrorMessage = '' - } catch { - $ErrorMessage = $_.Exception.Message - Write-Warning "Get-GPOZaurrPermissionConsistency - Processing $($GPO.DisplayName) / $($GPO.DomainName) failed to get consistency with error: $($_.Exception.Message)." - $IsConsistent = 'Not available' + $SysVolpath = -join ('\\', $Domain, '\sysvol\', $Domain, '\Policies\{', $GPO.ID.GUID, '}') + if (Test-Path -LiteralPath $SysVolpath) { + try { + $IsConsistent = $GPO.IsAclConsistent() + $ErrorMessage = '' + } catch { + $ErrorMessage = $_.Exception.Message + Write-Warning "Get-GPOZaurrPermissionConsistency - Processing $($GPO.DisplayName) / $($GPO.DomainName) failed to get consistency with error: $($_.Exception.Message)." + $IsConsistent = 'Not available' + } + } else { + Write-Warning "Get-GPOZaurrPermissionConsistency - Processing $($GPO.DisplayName) / $($GPO.DomainName) failed as path $SysvolPath doesn't exists!" + $IsConsistent = $false } - $SysVolpath = -join ('\\', $Domain, '\sysvol\', $Domain, '\Policies\{', $_.ID.GUID, '}') if ($VerifyInheritance) { if ($IsConsistent -eq $true) { $FolderPermissions = Get-WinADSharePermission -Path $SysVolpath -Verbose:$false diff --git a/README.md b/README.md index 713c0ee..34f7a43 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ That's it. Whenever there's a new version, you run the command, and you can enjo ## Changelog +- 0.0.75 - 8.11.2020 + - Improved `Get-GPOZaurrPermissionConsistency` to stop checking consistency if path doesn't exists - 0.0.74 - 8.11.2020 - Improved `Invoke-GPOZaurr` (WIP) - 0.0.73 - 7.11.2020