Powershell script getting error message - Get-NetAdapter : Invalid class

GreenParks2024 0 Reputation points
2024-05-17T00:35:40.6833333+00:00

Hello all,

I'm a noob here... I'm trying to run a script to get adapter info but getting error message. My goal is to get the adapter DNS ip info and changing it. Can someone tell whey I'm getting this message.

Current system: Windows 11 Pro (build 22631.3593), PS version 22621

Get all network interfaces

$interfaces = Get-NetAdapter | Where-Object { $_.Status -eq 'Up' }

Error message below:

Get-NetAdapter : Invalid class

At line:1 char:1

  • Get-NetAdapter | Where-Object { $_.Status -eq 'Up' }
  • 
        + CategoryInfo          : MetadataError: (MSFT_NetAdapter:ROOT/StandardCimv2/MSFT_NetAdapter) [Get-NetAdapter], CimException
    
        + FullyQualifiedErrorId : HRESULT 0x80041010,Get-NetAdapter
    
     
    
    
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,188 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MotoX80 32,331 Reputation points
    2024-05-20T15:02:08.9233333+00:00

    Your WMI repository is broken.

    https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-missing-or-failing-wmi-providers-or-invalid-wmi-class/ba-p/375485

    There are a number of sites that provide instruction on how to resolve the 0x80041010 error code.

    https://www.bing.com/search?q=0x80041010++rebuild+wmi