Hyper-V object was not found error

The scenario: Windows Server 2016 with Hyper-V role enabled.

When I pop out Powershell and try to get a list of VM i run in this error:

get-vm : Hyper-V encountered an error trying to access an object on computer 'S-HV01' because the object was not
found. The object might have been deleted. Verify that the Virtual Machine Management service on the computer is
At line:1 char:1
+ get-vm
+ ~~~~~~
 + CategoryInfo : ObjectNotFound: (:) [Get-VM], VirtualizationException
 + FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.GetVM

The same happen if I try to use Hyper-V Manager and connect to localhost.

Even the Event Viewer didn’t record any error/warning.

Rebuild WMI solve the problem. Run the command

MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mof