Hi,
It looks like you're encountering an error with the Get-WmiObject
cmdlet. The "Invalid class" error typically occurs when the specified WMI class is not available or not registered correctly on your system.
Here are a few steps you can try to resolve this issue:
- Verify WMI Repository: Run the following command in an elevated Command Prompt to check if the WMI repository is consistent:
winmgmt /verifyrepository
If it returns "Repository is inconsistent," you can try to repair it with:
winmgmt /salvagerepository
- Re-register WMI Components: You can re-register the WMI components by running the following commands in an elevated Command Prompt:
cd /d %windir%\system32\wbem
for %i in (*.dll) do regsvr32 -s %i
for %i in (*.exe) do %i /RegServer
- Recompile MOF Files: Recompile the MOF files to ensure all necessary classes are registered:
cd /d %windir%\system32\wbem
for %i in (*.mof, *.mfl) do mofcomp %i
- Check for Missing or Corrupt Files: Sometimes, missing or corrupt system files can cause this issue. Run the System File Checker tool:
sfc /scannow
If these steps don't resolve the issue, it might be helpful to check the Windows Application log for any WMI-related errors or events.
Let me know if you need further assistance!