I was getting PowerShell script failed errors for one of our servers being monitored via SCOM. The error was along these lines:
1 |
System.Management.Automation.ActionPreferenceStopException: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Invalid query "select * from Win32_PerfFormattedData_PerfProc_Process"At line:307 char:23 |
Not having much of an idea as to what the matter is (but having a hunch that it must be to do with performance monitors) I took a look at the events logs on the server and found entries like these:
1 2 3 4 5 6 7 8 |
In PerfDataSource, could not resolve counter Processor Information, % Processor Time, _Total. Module will not be unloaded. One or more workflows were affected by this. Workflow name: Microsoft.Windows.Server.10.0.OperatingSystem.TotalCPUUtilization Instance name: Microsoft Windows Server 2016 Datacenter Instance ID: {29A0EBB1-DCED-71E4-A74F-662E2BD3E1BF} Management group: xxxx |
There were many more like this (I found them all in the Administrative Events). To fix this I rebuilt the performance counters.
One caveat: the instruction in the link above ask us to go to “c:\windows\system32” and run a command “lodctr /R
“. This gave me an error: “Error: Unable to rebuild performance counter setting from system backup store, error code is 2”.
From a forum post I learnt that going to “c:\windows\syswow64” instead does the trick. So keep that in mind. :)