Solved

Get-WmiObject not working on one of my servers

Posted on 2010-09-18
3
5,085 Views
Last Modified: 2012-05-10
I'm trying to run a simple script to track basic disk information on my servers.  It runs remotely, but I've only gotten this error on one server, and I get the same error when I attempt to run it locally.  Here's the command:

$drives = Get-WmiObject -ComputerName "$server" Win32_LogicalDisk | Where-Object {$_.DriveType -eq 3}

And it returns the following error:

Get-WmiObject : not found
At line:1 char:14
+ get-wmiobject <<<< -ComputerName "$server" Win32_LogicalDisk | Where-Object {$_.DriveType -eq 3}

I did some additional troubleshooting, and I can't get GWMI to run on any class I've tried (win32_service,win32_logicaldisk,win32_environment).  As far as I can tell, I've got no other limitations on that server.  All of my exchange-related scripts run fine on it.  

Thoughts?

0
Comment
Question by:ittvictsiteadmin
  • 2
3 Comments
 

Author Comment

by:ittvictsiteadmin
ID: 33709940
Ok, it appears WMI is broken on that server.  When I tried to run wmimgmt.msc, it couldn't connect.  So I guess the problem is narrowed down.  Not quite sure where to go from here, though.
0
 
LVL 17

Accepted Solution

by:
Learnctx earned 250 total points
ID: 33710383
Try repairing the WMI repository.

For Server 2003:
rundll32 wbemupgd, RepairWMISetup

For Server 2008:
winmgmt /verifyrepository

If this doesn't work, try renaming or deleting the repository:

> Stop the WMI service.
net stop winmgmt

> Rename the existing WMI repository (though you may choose to just rename it).
Delete the Repository directory: %windir%\System32\Wbem\Repository

> Start the WMI service.
net start winmgmt

Beyond that you can try re-registering all of the DLLs and executables in the Wbem directory.
0
 
LVL 17

Expert Comment

by:Learnctx
ID: 33710385
Also to add there are risks with anything, so take the usual precautions you take with your servers making any changes to them :)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question