PSPKI icon indicating copy to clipboard operation
PSPKI copied to clipboard

Add-OnlineResponderArrayMember Doesn't Trigger Sync With Array Controller

Open raulc1022b opened this issue 1 year ago • 0 comments

Hello,

After adding new OCSP responder to an existing array with an existing controller using Connect-OnlineResponder -ComputerName $Controller | Add-OnlineResponderArrayMember -ArrayMember $Responder, the responder is added to the array, but the following error is thrown: **Exception calling "AddArrayMember" with "1" argument(s): "Value does not fall within the expected range. **

After synching array members with the controller manually, the configuration is set properly. Is the Add-OnlineResponderArrayMember cmdlet supposed to force the array sync? If not, is there another way to force the array sync through PowerShell?

I'm testing this script on a new Windows Server 2016 machine that is domain-joined.

Relevant script block below. Note - Prior to this script block. I install IIS and OCSP roles, then run certutil -VOCSPROOT.

$Hostname = hostname

## Get list of online responders
$ocspServers = Get-ADComputer -Filter { Name -like 'SomeComputerName*' } | Select-Object -ExpandProperty Name

## Loop through each OCSP Server to get config details
Foreach ($ocspServer in $ocspServers) {

    Try {

        Write-host "Attempting to connect to OCSP server $($ocspServer)"
        $ocspData = Connect-OnlineResponder -ComputerName $ocspServer
        If ($ocspData.IsArrayController -eq $true) {
            Write-Host "$($ocspServer) is array controller"
            Break
        }

    }
    catch {

        Write-Host "Unable to connect to OCSP server $($OCSPServer)" -ForegroundColor Yellow

    }
}

If (-not($ocspData)) {

    Throw "Unable to connect to any OCSP servers. Something went wrong."

}

# Get OCSP Array Controller
$Controller = $ocspData.ArrayController.ComputerName

Try {
      
    Write-Host "Adding $($Hostname) to OCSP array on controller $($Controller)"
  
    $Responder = Connect-OnlineResponder -ComputerName $Hostname
  
    # Add server as array Member on array controller
    Connect-OnlineResponder -ComputerName $Controller | Add-OnlineResponderArrayMember -ArrayMember $Responder -Verbose

    Write-Host "Successfully added $($Hostname) the OCSP array on controller $($Controller)." -ForegroundColor Green


}
Catch {

    $Message = $Global:Error[0]
    Write-Error "There was an error when adding array member, but the array may just need to be synched on the controller $($Controller).`r`n$($Message)"

}

Any assistance would be greatly appreciated. Thanks for your time!

raulc1022b avatar Nov 16 '22 20:11 raulc1022b