Skip to content

Use the newest CA in case of multiple available CAs or old CAs present #28

@gitnol

Description

@gitnol

$CAName = "$($CAs[0].Properties.dnshostname)\$($CAs[0].Properties.cn)"

in order to get the newest CA (in case of a CA which is older but alphabetically before the new CA) change this line (366) to:

            if($CAs.Count -ge 1){
                $newestCA = $CAs | Sort-Object -Property {$_.Properties.whenchanged} -Descending | Select -First 1
                $CAName = "$($newestCA.Properties.dnshostname)\$($newestCA.Properties.cn)"
            }
            else {
                $CAName = ""
            }

Further... it is more readable than using the Index 0 of the Array. :)

Thanks for your code. It helps a lot. I will adapt it for me

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions