Windows Management Instrumentation has received a few mentions around 404TS in recent months. This morning, I got a closer look at it again. I received what I like to call a “pile of symptoms” and get to try to find the root cause. The symptom that resulted in receiving the initial call was that shutdowns were taking about 10-15 minutes. The first technician to respond also noted that when looking at the Computer properties, it would return ‘not available’ for the “Processor:” and “Installed memory (RAM):” fields.
The computer was set to have a printer installed through the AD security group-based network printer install shutdown script I wrote. Kn0wing this, the technician included me in the troubleshooting process to see if there was something wrong with the script or some other configuration. Running the printer install script manually, an error message was returned. It gave a line number in the script and an error message of “The specified module could not be found”. Looking at the script, it was where a WMI method was being invoked to install the driver. To test WMI functionality further, I ran in the command prompt: wmic.exe computersystem get model. It returned the same error about the module could not be found.
The processor and Installed Memory fields were returning ‘not available’.
Seemingly narrowing the problem down to WMI not functioning correctly, I checked the computer’s services to ensure that the Windows Management Instrumentation service was Started and set to automatic. After confirming that it was started, I tried restarting the service but ran into the same results when trying to invoke something that used WMI.
Fortunately, I was able to find some suggested steps in a seemingly abandoned TechNet forum thread that had no further comments to confirm whether or not the problem worked for the requesting poster. Fortunately, I can confirm that the recommended steps work once the computer is restarted.
1. Log onto Windows 7 with an administrator account, click Start, type services.msc in the Start Search box and press Enter.
2. In the right pane of the Service console, locate and right-click Windows Management Instrumentation, and then select Stop to stop the service.
3. Start Windows Explorer, and then locate the %SystemRoot%System32WbemRepository folder.
4. Backup and delete all the files in the %SystemRoot%System32WbemRepository folder.
5. Restart the computer.
The files that were deleted will be re-created when the computer restarts.
Note: The Windows Management Instrumentation service starts automatically when you restart the computer.
If the issue persists, please re-register WMI DLL files and re-compile WMI mof files to check if the issue can be resolved. Here are the detailed steps:
1. Disable and stop the Windows Management Instrumentation service.
2. Right-click Command Prompt and select Run as Administrator.
3. In the Command Prompt, type cd %windir%system32wbem and press Enter.
4. Type for /f %s in (‘dir /b *.dll’) do regsvr32 /s %s and press Enter to re-register WMI DLL files.
5. After completed, type for /f %s in (‘dir /b *.mof’) do mofcomp %s and press Enter to re-compile WMI mof files.
6. After that, type the command wmiprvse /regserver and press Enter.
7. Start the Windows Management Instrumentation service and change the Startup Type back to Automatic.
Upon completing those steps and restarting the computer, all of the previous symptoms were resolved: Computer Properties lists available hardware, the printer script completed successfully and allowed the computer to shutdown is less than 30 seconds, and the WMIC command was able to return the model of the computer.