mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
22 lines
630 B
PowerShell
22 lines
630 B
PowerShell
function Test-IcingaCAInstalledToAuthRoot()
|
|
{
|
|
$IcingaCAFile = Join-Path -Path $Env:ProgramData -ChildPath 'icinga2\var\lib\icinga2\certs\ca.crt';
|
|
|
|
if ((Test-Path $IcingaCAFile) -eq $FALSE) {
|
|
return $FALSE;
|
|
}
|
|
|
|
$IcingaCACert = New-Object Security.Cryptography.X509Certificates.X509Certificate2 $IcingaCAFile;
|
|
|
|
[bool]$IcingaCAInstalled = $FALSE;
|
|
|
|
Get-ChildItem -Recurse -Path 'Cert:\LocalMachine\AuthRoot\' | Where-Object {
|
|
if ($_.Thumbprint -eq $IcingaCACert.Thumbprint) {
|
|
$IcingaCAInstalled = $TRUE;
|
|
}
|
|
};
|
|
|
|
$IcingaCACert = $null;
|
|
|
|
return $IcingaCAInstalled;
|
|
}
|