Repair the WMI repository the careful way
The winmgmt commands to check and repair a WMI repository in the safe order, and why /resetrepository is the last resort.
LanguageBatch
What it does to the systemMakes changes. Test it on one computer first.
A broken WMI repository stops the SCCM client. Inventory, policy and installs all depend on WMI.
Check first, then use the mildest repair that works. Most computers never need the full reset.
Batch
rem 1. Check the repository. This only reads.
winmgmt /verifyrepository
rem 2. If step 1 says the repository is not consistent, salvage it.
rem Salvage rebuilds the repository and keeps the data it can still read.
winmgmt /salvagerepository
rem 3. Check again. Run it twice if the first answer is still "not consistent".
winmgmt /verifyrepository
rem 4. LAST RESORT. Read the notes below first.
rem This resets the repository to the state of a fresh Windows install.
rem Remove the "rem" from the next line only if steps 1 to 3 have failed.
rem winmgmt /resetrepository
How to use it
- Open a Command Prompt as administrator on the computer.
- Run step 1. If it says "WMI repository is consistent", stop. WMI is not your problem.
- If it says the repository is not consistent, run step 2, then step 3.
- Restart the computer. Then check
C:\Windows\CCM\Logs\ClientIDManagerStartup.logandPolicyAgent.logfor new activity. - If the SCCM client still fails, reinstall the client with
ccmsetup.exe.
Good to know
- Warning:
/resetrepositorydeletes every WMI class that software added after Windows setup. That includes the SCCM client classes. Applications that depend on WMI can break. - After a reset, plan to reinstall the SCCM client. Other software may need a repair install too.
- Do not reset the repository on a server until you know what its server roles and applications store in WMI.
WMI
winmgmt
verifyrepository
salvagerepository
client health
More Command line
Uninstall the SCCM client cleanly and check that it is gone
Install the SCCM client with ccmsetup.exe and the most used switches
Mirror a content source folder with robocopy, logging and retries
Open the SCCM client control panel and Software Center from the command line
Reset Windows Update components
Run DISM and SFC health repair in the right order