How can I troubleshoot and fix Get-Net*
PowerShell cmdlets? All of the following are failing with Invalid class
. I'm using Windows 10, version 1511 and do not have the option to upgrade to 1607 at this point.
First PowerShell version:
PS C:\WINDOWS\system32> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 0 10586 672
Errors:
PS C:\WINDOWS\system32> Get-NetAdapter
Get-NetAdapter : Invalid class
At line:1 char:1
+ Get-NetAdapter
+ ~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (MSFT_NetAdapter:ROOT/StandardCimv2/MSFT_NetAdapter) [Get-NetAdapter], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041010,Get-NetAdapter
PS C:\WINDOWS\system32> Get-NetIPAddress
Get-NetIPAddress : Invalid class
At line:1 char:1
+ Get-NetIPAddress
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (MSFT_NetIPAddress:ROOT/StandardCimv2/MSFT_NetIPAddress) [Get-NetIPAddress], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041010,Get-NetIPAddress
PS C:\WINDOWS\system32> Get-NetAdapterHardwareInfo
Get-NetAdapterHardwareInfo : Invalid class
At line:1 char:1
+ Get-NetAdapterHardwareInfo
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (MSFT_NetAdapterHardwareInfoSettingData:ROOT/StandardCi...InfoSettingData
) [Get-NetAdapterHardwareInfo], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041010,Get-NetAdapterHardwareInfo
PS C:\WINDOWS\system32> Get-NetAdapterBinding
Get-NetAdapterBinding : Invalid class
At line:1 char:1
+ Get-NetAdapterBinding
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (MSFT_NetAdapterBindingSettingData:ROOT/StandardCi...dingSettingData) [Ge
t-NetAdapterBinding], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041010,Get-NetAdapterBinding
PS C:\WINDOWS\system32> Get-NetAdapterStatistics -Name "Wi-Fi"
Get-NetAdapterStatistics : Invalid class
At line:1 char:1
+ Get-NetAdapterStatistics -Name "Wi-Fi"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (MSFT_NetAdapterStatisticsSettingData:ROOT/StandardCi...ticsSettingData)
[Get-NetAdapterStatistics], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041010,Get-NetAdapterStatistics
PS C:\WINDOWS\system32> Get-NetAdapterStatistics -Name "Ethernet"
Get-NetAdapterStatistics : Invalid class
At line:1 char:1
+ Get-NetAdapterStatistics -Name "Ethernet"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (MSFT_NetAdapterStatisticsSettingData:ROOT/StandardCi...ticsSettingData)
[Get-NetAdapterStatistics], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041010,Get-NetAdapterStatistics
I'm trying to use Docker for Windows 10 (which used to work) but the PowerShell failures are causing Docker to not start (GitHub issue). The errors are occurring on my host, not inside Docker containers. For the sake of this question you should ignore the Docker details, it is just that I cannot use Docker due to this problem.
Thanks to a thread on the Microsoft TechNet Forum, we can see that the WMI repository is corrupted and can be fixed as follows:
sc config winmgmt start= disabled net stop winmgmt
Winmgmt /salvagerepository %windir%\System32\wbem Winmgmt /resetrepository %windir%\System32\wbem
sc config winmgmt start= auto
If the problem remains, then try the following steps to rebuild the repository:
sc config winmgmt start= disabled (note that there is a blank between '=' and 'disabled') net stop winmgmt
Rename the repository folder (located at %windir%\System32\wbem\repository
) to repository.old
Re-enable the WMI service
sc config winmgmt start= auto
If the above doesn't work try chkdsk
, sfc
, and dism
. Additionally you can try a Windows Repair Install.
User contributions licensed under CC BY-SA 3.0