Skip to content

Commit

Permalink
Avoid the use of deprecated wmic command
Browse files Browse the repository at this point in the history
  • Loading branch information
car031 committed Oct 19, 2023
1 parent f0a7cf3 commit 7bf8b38
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private int getCpuLoadOnWindows() {
try {
Exec exec = new Exec();
exec.setOutPrefix(null);
exec.exec("wmic cpu get loadpercentage", null, null, sb, 5);
exec.exec("Powershell \"[string][int](Get-Counter '\\Processor(*)\\% Processor Time').Countersamples[0].CookedValue", null, null, sb, 5);
} catch (IOException e1) {
log.warn(e1.getMessage(), e1);
return 0;
Expand Down

0 comments on commit 7bf8b38

Please sign in to comment.