Moskie
Moskie

Reputation: 1287

Get-WMIObject returns an error without a description

On one of our production servers, I started to get an error while running our scripts. Stripping down the code, I receive the error when running this command from the PowerShell prompt:

Get-WmiObject -Class win32_volume

The result is this:

Get-WmiObject :
At line:1 char:14
+ Get-WmiObject <<<<  -Class win32_volume
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMException
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

What's noticable to me is that there's no description of the error on the first line of the result. This script has worked in the past, and continues to work on our other servers.

I'm running this as an administrator on the server, and the PowerShell session is in administrator mode. Any suggestions about what to do to solve this?

Thanks.

Upvotes: 9

Views: 12573

Answers (3)

topcav
topcav

Reputation: 31

We had this error and WMI had crashed without giving any indications that it had done so- restarting it solved the problem.

Upvotes: 3

ewall
ewall

Reputation: 28120

You could also try the WMI Diagnosis Utility to help figure out what's going on.

Upvotes: 0

user847990
user847990

Reputation:

There is a way to get to the more detailed error information in PowerShell...you can read more here: http://meltondba.wordpress.com/2011/07/21/the-rest-of-the-story-powershell-errors/

Pretty much just execute this after you hit the error, if you are on the command line. If you are working with a script I provide link to Allen White's post on how to capture the error.

$error[0] | Format-List InnerException -Force

You might actually be able to do it after you execute the script. I think it holds the last error it caught, but not sure on that one.

Upvotes: 0

Related Questions