Solved

Get-WmiObject not working on one of my servers

Posted on 2010-09-18
3
5,176 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 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