windowswmi

WMI query hangs and never finish


Good morning, I try to execute this command: Get-WmiObject Win32_OptionalFeature and never finish... How can I troubleshoot this? I try to recreate the repository but nothing works:

net stop "Background Intelligent Transfer Service"
net stop "COM+ Event System"
net stop "Microsoft Software Shadow Copy Provider"
net stop "Volume Shadow Copy"
net stop Winmgmt
net stop WSearch
cd /d %windir%\system32\wbem
dir /b *.dll > dlllist.txt
dir /b *.mof > moflist.txt
dir /b /s *.mfl > mfllist.txt
for /f %f in (dlllist.txt) do regsvr32 /s %
for /f %s in (moflist.txt) do mofcomp %s
for /f %s in (mfllist.txt) do mofcomp %s
net start "Background Intelligent Transfer Service"
net start "COM+ Event System"
net start "Microsoft Software Shadow Copy Provider"
net start "Volume Shadow Copy"
net start Winmgmt
net start WSearch
del dllist.txt /Q
del moflist.txt /Q
del mfllist.txt /Q
wmiprvse /regserver

TIA!!

I try to recreate the repository of WBEM but doesn't work... I want to troubleshoot this issue.

Thanks


Solution

  • Solution to the issue: Reboot the machine.