I am trying to get the cpu usage value as similar as possible to how task manager shows it. Checking this Abraham Zinala comment, This counter \Processor Information(*)\% Processor Utility matches pretty close to the task manager report.
However, my Windows 11 is in Spanish so I had to find out the ID of the counters in order not to have problems wherever this command is executed regardless of the system language.
I get the both IDs Checking the Perflib register as suggested
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009
2454
Processor Information
2508
% Processor Utility
Asking by ID for this counter t responds that the counters are not valid.
typeperf "\2454(*)\2508"
Error: contadores no válidos.
However, I can get the value perfectly if I request it with the Spanish name equivalent.
typeperf "\Información del procesador(*)\% de utilidad del procesador"
"12/08/2023 21:19:27.006","4.264393","0.043666","22.416960","0.039292","21.000396"
Checking HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\CurrentLanguage I realize there are only ~2000 of the counters translated, vs 6000 in the english registry. Processor Information & Processor Utility are not there
I have done some more random tests with other counters, and the conclusion I draw is that I can only get the counters by ID that already exist in CurrentLanguage rather than in 009 (English).
As example, it's works perfectly with typeperf "\238(*)\6" that it's equivalent to typeperf "\Procesador(*)\% de tiempo de procesador" and both are in CurrentLanguage register
Note: I have found out the Processor Information(*)% Processor Utility value in Spanish using typeperf -q and looking for a near translation meaning
\Información del procesador(*)\Marcas de límite de rendimiento
\Información del procesador(*)\% de límite de rendimiento
\Información del procesador(*)\% de utilidad privilegiada
\Información del procesador(*)\% de utilidad del procesador
\Información del procesador(*)\% de rendimiento del procesador