Life of a techno-guru
Thursday, June 15, 2006
  Fixing problems with WMI
Sometimes (rarely though) you will have a case where the WMI repository gets corrupted, and when you have a script that attempts to run, you get a Null Exception or something like that. Anyway, that's what I got a couple of times today when I deployed a script that applies a few registry changes using the root\default:StdRegProv class, and I got a couple of reports of it erroring. I didn't initially know any better, but I thought that maybe the StdRegProv class didn't exist in Windows XP SP1 (hence the Null Reference), but that wasn't the case, because it worked on some other SP1 machines. It wasn't until I tried connecting to the root\cimv2 namespace on the couple of affected machines that I understood what was going on; the WMI repository was corrupt. Here's a quick way of testing if there's a problem with WMI:

At this point, if you get an error saying Invalid Namespace or This Operation is Not Supported, or anything to that effect, chances are that you have a problem with the WMI repository. The reason for this, is that the root\cimv2 is what you could call the "primary" namespace of WMI, or the one that provides the most information about your system; If this namespace isn't working, it's likely that none of them are. Now, here's the steps you can take to actually fix the problem:

Refresh the WMI Repository
Test the WMI Repository
At this point, your computer may hesitate for a moment while it rebuilds the WMI repository. Remember, after you delete the repostiory and restart the service, WMI doesn't rebuild the repository until you actually use the WMI service. From this point forward, your problems ought to be resolved and you can go on scripting (or programming) happily :-)
 
Comments: Post a Comment



<< Home
My life of learning various things about technology including network administration, development, and 3D design

Name:
Location: Chicago, Illinois, United States
ARCHIVES
January 2006 / February 2006 / March 2006 / May 2006 / June 2006 / July 2006 / August 2006 / September 2006 / October 2006 / November 2006 / December 2006 / January 2007 / February 2007 / March 2007 / April 2007 / May 2007 / June 2007 / August 2007 / December 2007 / January 2008 / March 2008 / April 2008 / June 2008 / July 2008 / September 2008 / December 2008 / January 2009 / February 2009 / March 2009 / May 2009 /


Powered by Blogger