but I am getting the error: vSphereCPUSocketToCoreUsage.psm1 was not loaded because no valid module file was found in any module directory.
1. Which OS do you have?
2. Do you have PowerCLI modules installed?
3. What version of PowerCLI are you using?
I would install the latest PowerCLI version it should solve the issue.