Trouble with Get-WmiObject Command on Windows Server 2012

0
2
Asked By TechWhiz42 On

I'm trying to run the command `Get-WmiObject -ClassName Cim_logicaldevice` on my Windows Server 2012 virtual machine. While it gets some output, I also receive an error message at the end. Here's the output I see:

```
LastErrorCode :
Manufacturer : (Standard system devices)
Name : System CMOS/real time clock
PNPClass : System
PNPDeviceID :
PowerManagementCapabilities :
PowerManagementSupported :
Present : True
Service :
Status : OK
StatusInfo :
SystemCreationClassName : Win32_ComputerSystem
SystemName : SystemName1
PSComputerName : SystemName1
```

Then it gives this error:
```
Get-WmiObject : Generic failure
At line:1 char:1
+ Get-WmiObject -ClassName Cim_logicaldevice
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
```

Can anyone help me figure out what's going wrong and how to fix it?

2 Answers

Answered By ErrorExplorer88 On

We might need a bit more detail on the error. You can check additional error properties with the command:

```
$error[0]
```
Or use `get-error` if you have a newer version of PowerShell. This might give you clearer insights into what's going wrong.

Answered By SyntaxSleuth99 On

Have you tried running these alternative commands to see if they produce the same error?

```
Get-CimInstance cim_logicaldevice
pnputil.exe /enum-devices
```
This might help narrow down the issue you're facing.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.