@@ -1569,8 +1569,8 @@ function Find-ESC7 {
15691569 )
15701570 process {
15711571 $ADCSObjects | Where-Object {
1572- ($_.objectClass -eq ' pKIEnrollmentService' ) -and
1573- ( ($_.CAAdministrator -notmatch ' Failure|CA Unavailable ' ) -or ($_.CertificateManager ) )
1572+ ($_.objectClass -eq ' pKIEnrollmentService' ) -and $_ .CAHostDistinguishedName -and
1573+ ( ($_.CAAdministrator ) -or ($_.CertificateManager ) )
15741574 } | ForEach-Object {
15751575 $UnsafeCAAdministrators = Write-Output $_.CAAdministrator - PipelineVariable admin | ForEach-Object {
15761576 $SID = Convert-IdentityReferenceToSid - Object $admin
@@ -1613,7 +1613,7 @@ Reinstate CA Administrator rights for $($UnsafeCAAdministrators -join ', ')
16131613 }
16141614 if ($UnsafeCertificateManagers ) {
16151615 $Issue.Issue = $Issue.Issue + @"
1616- Unexpected principals are granted "Certificate Manager" rights on this Certification Authority.
1616+ expected principals are granted "Certificate Manager" rights on this Certification Authority.
16171617Unexpected Principals: $ ( $UnsafeCertificateManagers -join ' , ' )
16181618
16191619"@
@@ -2044,12 +2044,22 @@ function Get-CAHostObject {
20442044 process {
20452045 if ($Credential ) {
20462046 $ADCSObjects | Where-Object objectClass -Match ' pKIEnrollmentService' | ForEach-Object {
2047- Get-ADObject $_.CAHostDistinguishedName - Properties * - Server $ForestGC - Credential $Credential
2047+ if ($_.CAHostDistinguishedName ) {
2048+ Get-ADObject $_.CAHostDistinguishedName - Properties * - Server $ForestGC - Credential $Credential
2049+ }
2050+ else {
2051+ Write-Warning " Get-CAHostObject: Unable to get information from $ ( $_.DisplayName ) "
2052+ }
20482053 }
20492054 }
20502055 else {
20512056 $ADCSObjects | Where-Object objectClass -Match ' pKIEnrollmentService' | ForEach-Object {
2052- Get-ADObject $_.CAHostDistinguishedName - Properties * - Server $ForestGC
2057+ if ($_.CAHostDistinguishedName ) {
2058+ Get-ADObject - Identity $_.CAHostDistinguishedName - Properties * - Server $ForestGC
2059+ }
2060+ else {
2061+ Write-Warning " Get-CAHostObject: Unable to get information from $ ( $_.DisplayName ) "
2062+ }
20532063 }
20542064 }
20552065 }
0 commit comments