Hi there,
WMI can fail for a number of reasons. Some of those can include not having appropriate rights and permissions for access to machines or namespaces, problems with provider registration, corrupted repository, and scripting errors to name a few.
The below article will help you in troubleshooting this issue.WMI: Can't Connect to Remote WMI https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-can-t-connect-to-remote-wmi/ba-p/373838#:~:text=Description%3A%20WMI%20can%20fail%20for,errors%20to%20name%20a%20few.
--If the reply is helpful, please Upvote and Accept it as an answer--