Skip to content

Get-IcingaNetworkInterface.psm1 throws error on Windows Server 2016 #38

@hoftech

Description

@hoftech

Expected Behavior

It should return the IP address of the host.

Current Behavior

PS C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\core\tools> Get-IcingaNetworkInterface server.domain.local
Das Argument "value" mit dem Wert  "fe80::fcec:11e5:c7c3:1411%4 192" für "ToString" kann nicht in den Typ
"System.Int64" konvertiert werden: "Der Wert "fe80::fcec:11e5:c7c3:1411%4 192" kann nicht in den Typ "System.Int64"
konvertiert werden. Fehler: "Die Eingabezeichenfolge hat das falsche Format.""
In C:\Program
Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\core\tools\ConvertTo-IcingaIPv4BinaryString.psm1:29
Zeichen:9
+         [System.Convert]::ToString($_, 2).PadLeft(8, '0');
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Das Argument "value" mit dem Wert  "fe80::5efe:192" für "ToString" kann nicht in den Typ "System.Int64" konvertiert
werden: "Der Wert "fe80::5efe:192" kann nicht in den Typ "System.Int64" konvertiert werden. Fehler: "Die
Eingabezeichenfolge hat das falsche Format.""
In C:\Program
Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\core\tools\ConvertTo-IcingaIPv4BinaryString.psm1:29
Zeichen:9
+         [System.Convert]::ToString($_, 2).PadLeft(8, '0');
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Get-NetIPAddress : Durch "CIM-Abfrage für Instanzen der Klasse "ROOT/StandardCimv2/MSFT_NetIPAddress" auf dem
CIM-Server "": SELECT * FROM MSFT_NetIPAddress  WHERE ((InterfaceIndex = 3)) AND ((AddressFamily = 2))" wurden keine
übereinstimmenden MSFT_NetIPAddress-Objekte gefunden. Überprüfen Sie die Abfrageparameter, und wiederholen Sie den
Vorgang.
In C:\Program
Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\core\tools\Get-IcingaNetworkInterface.psm1:120
Zeichen:22
+ ...    return ((Get-NetIPAddress -InterfaceIndex $Route.Value.Interface - ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_NetIPAddress:String) [Get-NetIPAddress], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-NetIPAddress

Steps to Reproduce (for bugs)

  1. Import C:\Program
    Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\core\tools\Get-IcingaNetworkInterface.psm1
  2. Run Get-IcingaNetworkInterface localserver.domain.local (Throws the error above)

Context

I was trying to add a new host with the director self-service api. And got the following error:
Failed to register host within Icinga Director. Please re-enter your SelfService API Key. ...
I tried to add the host manually with Register-IcingaDirectorSelfServiceHost an got the following error.

PS C:\Windows\system32> Register-IcingaDirectorSelfServiceHost -DirectorUrl "https://monitoring-master-1.domain.com/icin
gaweb2/director/" -ApiKey "7130a1842ced000ee11abe8b95f0c42f7c834db4" -HostName "server.domain.local" -endpoint "monitoring
-master-1.domain.com"
Das Argument "value" mit dem Wert  "fe80::5efe:192" für "ToString" kann nicht in den Typ "System.Int64" konvertiert
werden: "Der Wert "fe80::5efe:192" kann nicht in den Typ "System.Int64" konvertiert werden. Fehler: "Die
Eingabezeichenfolge hat das falsche Format.""
In C:\Program
Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\core\tools\ConvertTo-IcingaIPv4BinaryString.psm1:29
Zeichen:9
+         [System.Convert]::ToString($_, 2).PadLeft(8, '0');
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Get-NetIPAddress : Durch "CIM-Abfrage für Instanzen der Klasse "ROOT/StandardCimv2/MSFT_NetIPAddress" auf dem
CIM-Server "": SELECT * FROM MSFT_NetIPAddress  WHERE ((InterfaceIndex = 4)) AND ((AddressFamily = 2))" wurden keine
übereinstimmenden MSFT_NetIPAddress-Objekte gefunden. Überprüfen Sie die Abfrageparameter, und wiederholen Sie den
Vorgang.
In C:\Program
Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\core\tools\Get-IcingaNetworkInterface.psm1:120
Zeichen:22
+ ...    return ((Get-NetIPAddress -InterfaceIndex $Route.Value.Interface - ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_NetIPAddress:String) [Get-NetIPAddress], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-NetIPAddress

I have this problem on 2 Servers in the same Windows Domain. I couldn't test it on other systems yet.

Your Environment

PowerShell Version

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  3383

Server 2016 Standard

Version    BuildNumber Caption`
-------    ----------- --------
10.0.14393 14393

Metadata

Metadata

Assignees

Labels

BugThere is an issue present

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions