mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Fix Host FQDN building
Fixes #9 to ensure the hostname is always build properly, regardless of Domain, DNS Suffix or Hostname
This commit is contained in:
parent
071d1f3c19
commit
09e406b90c
2 changed files with 2 additions and 10 deletions
|
|
@ -17,11 +17,7 @@ $Checker | Add-Member -membertype ScriptMethod -name 'Start' -value {
|
||||||
$WindowsInformations = Get-CimInstance Win32_OperatingSystem;
|
$WindowsInformations = Get-CimInstance Win32_OperatingSystem;
|
||||||
$this.version = $WindowsInformations.CimInstanceProperties['Version'].Value;
|
$this.version = $WindowsInformations.CimInstanceProperties['Version'].Value;
|
||||||
$this.os = $WindowsInformations.CimInstanceProperties['Caption'].Value;
|
$this.os = $WindowsInformations.CimInstanceProperties['Caption'].Value;
|
||||||
$this.fqdn = [string]::Format(
|
$this.fqdn = [System.Net.Dns]::GetHostEntry('localhost').HostName;
|
||||||
'{0}.{1}',
|
|
||||||
(Get-WmiObject Win32_ComputerSystem).DNSHostName,
|
|
||||||
(Get-WmiObject win32_computersystem).Domain
|
|
||||||
);
|
|
||||||
|
|
||||||
$Icinga2.Log.Write(
|
$Icinga2.Log.Write(
|
||||||
$Icinga2.Enums.LogState.Info,
|
$Icinga2.Enums.LogState.Info,
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,7 @@ $SSL | Add-Member -membertype ScriptMethod -name 'LoadServerCertificate' -value
|
||||||
|
|
||||||
# Try to discover the certificate based on our FQDN
|
# Try to discover the certificate based on our FQDN
|
||||||
if ([string]::IsNullOrEmpty($CertName) -eq $TRUE -And [string]::IsNullOrEmpty($CertThumbprint) -eq $TRUE) {
|
if ([string]::IsNullOrEmpty($CertName) -eq $TRUE -And [string]::IsNullOrEmpty($CertThumbprint) -eq $TRUE) {
|
||||||
$CertName = [string]::Format(
|
$CertName = [System.Net.Dns]::GetHostEntry('localhost').HostName;
|
||||||
'{0}.{1}',
|
|
||||||
(Get-WmiObject Win32_ComputerSystem).DNSHostName,
|
|
||||||
(Get-WmiObject win32_computersystem).Domain
|
|
||||||
);
|
|
||||||
|
|
||||||
$Icinga2.Log.Write(
|
$Icinga2.Log.Write(
|
||||||
$Icinga2.Enums.LogState.Info,
|
$Icinga2.Enums.LogState.Info,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue