Werk #13348: windows_if.ps1: Use Get-NetAdapter if possible

Component Checks & agents
Title windows_if.ps1: Use Get-NetAdapter if possible
Date Oct 1, 2021
Checkmk Edition Checkmk Raw (CRE)
Checkmk Version 2.1.0b1
Level Trivial Change
Class Bug Fix
Compatibility Incompatible - Manual interaction might be required

The Windows agent plugin windows_if.ps1, deployed via the bakery ruleset 'Network interfaces on Windows', collects additional data about network interfaces, such as aliasses and MAC addresses. Up to now, the plugin used Get-WmiObject Win32_NetworkAdapter to collect this information. However, Win32_NetworkAdapter is deprecated and might return wrong aliasses for certain network adapters.

Now, the plugin attempts to use Get-NetAdapter instead. If this is not available, it falls back to Win32_NetworkAdapter.

For most interfaces, this change should be compatible, since Win32_NetworkAdapter and Get-NetAdapter produce mostly identical output. However, as mentioned earlier, there might be interfaces for which e.g. the alias changes.

To the list of all Werks