Sample code for 30+ languages & platforms
PowerShell Requires Chilkat v11.0.0+

Transition from Cert.GetCertChain to Cert.BuildCertChain

Provides instructions for replacing deprecated GetCertChain method calls with BuildCertChain.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$cert = New-Object Chilkat.Cert

#  ------------------------------------------------------------------------
#  The GetCertChain method is deprecated:

$certchainObj = $cert.GetCertChain()
if ($cert.LastMethodSuccess -eq $false) {
    $($cert.LastErrorText)
    exit
}

#  ...
#  ...

#  ------------------------------------------------------------------------
#  Do the equivalent using BuildCertChain.
#  Your application creates a new, empty CertChain object which is passed 
#  in the last argument and filled upon success.

$certchainOut = New-Object Chilkat.CertChain
$success = $cert.BuildCertChain($certchainOut)
if ($success -eq $false) {
    $($cert.LastErrorText)
    exit
}