I recently came across a Hyper-V host which after a power outage and a dirty shut down, due the absence of a UPS, could not connect to the Virtual Machine Management Service. When opening the Hyper-v console the VMs were not listed, and selecting “Connect to Server” resulted in the following error message; “An error occurred while attempting to connect to server ‘ServerName’. Check that the Virtual Machine Service is running and that you are authorized to connect to the server.”
The Hyper-V services displayed running in the Services management console, and permissions had not changed, however when checking for dependencies for the Hyper-V Virtual Management Service it show no dependencies. Comparing this to another Hyper-V host reveals the service depends on the Remote Procedure Call (RPC) and Windows Management Instrumentation service. Both of these were running as well.
When services and system information is not present in various consoles, and the WMI service is running, it can often be a result of missing or corrupt WMI files. You can confirm this by running msinfo32.exe (System Information). If so, you will receive a message “Can’t collect Information. Cannot access the Windows Management Instrumentation software. Windows Management files may be moved or missing.”
If this is the case there is an easy fix:
- Always have a full backup of your system before making any changes!
- Note: Microsoft recommends troubleshooting, and restoring the WMI files rather than deleting them as I describe here. Deleting the files can affect 3rd party software which may require reinstalling. For more information see the links at the end of this article. In this case the WMI checks showed no inconsistencies and a reset failed, so rebuilding was the best option.
- Stop the Windows Management Instrumentation service, which will warn you that it will also stop the Hyper-V Virtual Machine Management and other services, verifying the link between the two.
- Rename the WMI information file folder to something such as .old C:\Windows\System32\wbem\Repository.old
- Restart the host. Upon reboot it will recreate the Repository folder and its contents. You may find the first logon hangs for a few minutes and also it may be slow for a while as it rebuilds the files.