diff --git a/core/include/Checker.ps1 b/core/include/Checker.ps1 index b408c84..97720eb 100644 --- a/core/include/Checker.ps1 +++ b/core/include/Checker.ps1 @@ -17,11 +17,7 @@ $Checker | Add-Member -membertype ScriptMethod -name 'Start' -value { $WindowsInformations = Get-CimInstance Win32_OperatingSystem; $this.version = $WindowsInformations.CimInstanceProperties['Version'].Value; $this.os = $WindowsInformations.CimInstanceProperties['Caption'].Value; - $this.fqdn = [string]::Format( - '{0}.{1}', - (Get-WmiObject Win32_ComputerSystem).DNSHostName, - (Get-WmiObject win32_computersystem).Domain - ); + $this.fqdn = [System.Net.Dns]::GetHostEntry('localhost').HostName; $Icinga2.Log.Write( $Icinga2.Enums.LogState.Info, diff --git a/core/include/utils/SSL.ps1 b/core/include/utils/SSL.ps1 index db32805..3db0349 100644 --- a/core/include/utils/SSL.ps1 +++ b/core/include/utils/SSL.ps1 @@ -24,11 +24,7 @@ $SSL | Add-Member -membertype ScriptMethod -name 'LoadServerCertificate' -value # Try to discover the certificate based on our FQDN if ([string]::IsNullOrEmpty($CertName) -eq $TRUE -And [string]::IsNullOrEmpty($CertThumbprint) -eq $TRUE) { - $CertName = [string]::Format( - '{0}.{1}', - (Get-WmiObject Win32_ComputerSystem).DNSHostName, - (Get-WmiObject win32_computersystem).Domain - ); + $CertName = [System.Net.Dns]::GetHostEntry('localhost').HostName; $Icinga2.Log.Write( $Icinga2.Enums.LogState.Info,