Repairing /Fixing WMI Repository

Rebuilding the WMI Repository

If you experience behavior when using WMI, such as application errors or scripts that used to work are no longer working, you may have a corrupted WMI repository. To fix a corrupted WMI repository, use these steps:

Windows XP and Windows Vista

Click Start, Run and type CMD.EXE

Note: In Windows Vista, you need to open an elevated Command Prompt window. To do so, click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.

Type this command and press Enter:

net stop winmgmt

Using Windows Explorer, rename the folder %windir%\System32\Wbem\Repository. (For example, %windir%\System32\Wbem\Repository_bad). %windir% represents the path to the Windows directory, which is typically C:\Windows.

Switch to Command Prompt window, and type the following and press ENTER after each line:

net start winmgmt


Courtesy: The above is excerpted from Microsoft Technet article WMI Isn’t Working!
© 2007 Microsoft Corporation. All rights reserved.

For Windows XP Service Pack 2

Click Start, Run and type the following command:

rundll32 wbemupgd, UpgradeRepository

This command is used to detect and repair a corrupted WMI Repository. The results are stored in the setup.log (%windir%\system32\wbem\logs\setup.log) file.

For Windows Vista

Open an elevated Command Prompt window. To do so, click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.

Type the following command:

winmgmt  /salvagerepository

The above command Performs a consistency check on the WMI repository, and if an inconsistency is detected, rebuilds the repository. The content of the inconsistent repository is merged into the rebuilt repository, if it can be read.

For Windows Server 2003

Use the following command to detect and repair a corrupted WMI Repository:

rundll32 wbemupgd, RepairWMISetup

Re-registering the WMI components (Ref WMI FAQ)

The .DLL and .EXE files used by WMI are located in %windir%\system32\wbem. You might need to re-register all the .DLL and .EXE files in this directory. If you are running a 64-bit system you might also need to check for .DLLs and .EXE files in %windir%\sysWOW64\wbem.

To re-register the WMI components, run the following commands at the command prompt:

  • cd /d %windir%\system32\wbem
  • for %i in (*.dll) do RegSvr32 -s %i
  • for %i in (*.exe) do %i /RegServer

Note that none of the above two methods restore the missing files related to Windows Management Instrumentation (WMI). So, below is a comprehensive repair procedure that restores all the missing WMI modules. In case of missing WMI modules, you may use the following method.

Microsoft has released a new diagnosis tool that helps system administrators diagnose and repair problems with the WMI. It is advisable to go through the WMIDiag_ReadMe.doc file to understand how the utility works, and the supported command-line arguments. Here is the download link: The WMI Diagnosis Utility

You may use the utility (WMIDiag.vbs) to find if a repository rebuild is necessary or not. The utility runs a comprehensive testing of WMI and reports the results to a log file, which is placed in the user’s Temp folder (%Temp%) folder by default.

II_INSTALLATION must be set before the configuration utility is run

When rebooting a server with problems, it could lead to a corrupt ingress installation.

This leads to all kind of problems. When starting the Ingres Visual Manager you get an error: “II_INSTALLATION must be set before the configuration utility is run”.

To fix this problem you need to restore the symbols.tbl file located in the ingres\files directory. If you want to restore them manually, you need to know the original settings. You can get them back with the utility: ingsetenv.exe

If you restore the file, make sure ingres is down and run after the restore the following commands as you have in your Install.log

“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_LANGUAGE ENGLISH
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_TIMEZONE_NAME NA-EASTERN
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” TERM_INGRES IBMPCD
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_INSTALLATION II
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_CHARSETII WIN1252
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingunset.exe” II_CHARSET
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_DATE_FORMAT US
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_MONEY_FORMAT L:$
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_DECIMAL .
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_TEMPORARY “C:\Program Files\CA\Ingres [II]\ingres\temp”
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_CONFIG “C:\Program Files\CA\Ingres [II]\ingres\files”
“C:\Program Files\CA\Ingres [II]\ingres\bin\ingsetenv.exe” II_GCNII_LCL_VNODE “<YOUR_COMPUTER_NAME"

If you do not know the exact settings, you can try to take a look at the install.log. The settings of the ingres environment are also mentioned their.