Solved

Get-WmiObject not working on one of my servers

Posted on 2010-09-18
3
4,799 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
Comment Utility
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 16

Accepted Solution

by:
Learnctx earned 250 total points
Comment Utility
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 16

Expert Comment

by:Learnctx
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
This article will help you understand what HashTables are and how to use them in PowerShell.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now