Solved

Get-WmiObject not working on one of my servers

Posted on 2010-09-18
3
4,958 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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

12 Experts available now in Live!

Get 1:1 Help Now