Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get-WmiObject not working on one of my servers

Posted on 2010-09-18
3
Medium Priority
?
6,000 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 18

Accepted Solution

by:
Learnctx earned 1000 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 18

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/rece…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

609 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