Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WMIC has been deprecated in Windows 11 and is now no longer available #442

Open
doughsay opened this issue Dec 3, 2024 · 7 comments
Open

Comments

@doughsay
Copy link

doughsay commented Dec 3, 2024

This line here:

parse_cpu_for(:Windows, system_cmd("WMIC", ["CPU", "GET", "NAME"]))

Appears to fail on up-to-date Windows 11 systems due to WMIC having been deprecated.

Here's an article announcing the deprecation: https://techcommunity.microsoft.com/blog/windows-itpro-blog/wmi-command-line-wmic-utility-deprecation-next-steps/4039242

It seems the only alternative is to use powershell, according to that article. I'm pretty unfamiliar with windows development, so I don't really know the best way to fix this...

@PragTob
Copy link
Member

PragTob commented Dec 4, 2024

👋

Hey, thank you for the issue and the announcement! But also... ooof. I think that was mostly done externally back then as well and I also don't have a Windows 11 device to test this right now (yeah there should still be the VMs around).

What's the impact right now? Does benchee crash as a whole or does it just not report the values? I dearly hope the latter otherwise we got some fixing to do 😅

@PragTob
Copy link
Member

PragTob commented Dec 4, 2024

@OvermindDL1 you still around? Any ideas? 😁

@kshannoninnes
Copy link

kshannoninnes commented Dec 4, 2024

Sorry, he made the issue on my behalf (I brought it up in the Elixir discord but it was 4:30am and I was heading to bed). I'll be happy to run tests/answer any questions about the issue, although given timezones, It'll probably be several hours before I'm awake again.

Running the latest up to date Windows 11 (reinstalled from scratch around a week prior to this issue) with Erlang 27 and Elixir 1.17.3

Minimal Reproducible Example

Mix.install([
    {:benchee, "~> 1.0"}
])

Benchee.run(%{
    "test" => fn -> IO.puts("Hello World") end
})

Resulting Output

C:\Users\*******\Documents\Elixir\aoc2024>elixir test.exs
** (ErlangError) Erlang error: :enoent
    (elixir 1.17.3) lib/system.ex:1114: System.cmd("WMIC", ["COMPUTERSYSTEM", "GET", "TOTALPHYSICALMEMORY"], [])
    (benchee 1.3.1) lib/benchee/system.ex:235: Benchee.System.system_cmd/3
    (benchee 1.3.1) lib/benchee/system.ex:171: Benchee.System.available_memory/1
    (benchee 1.3.1) lib/benchee/system.ex:57: Benchee.System.system/1
    (benchee 1.3.1) lib/benchee.ex:46: Benchee.run/2
    test.exs:6: (file)

@PragTob
Copy link
Member

PragTob commented Dec 4, 2024

@kshannoninnes got it, thanks! I should be able to at least stop that from failing and leave retrieving the value for later....

maybe I should join the elixir discord to be pingable there.

@OvermindDL1
Copy link

Honestly no clue beyond just doing it in powershell, it's not really any slower than wmic too (especially once it's cached).

What are you trying to get information of that BEAM doesn't already expose somehow?

I guess you could go the sledgehammer method and make a rustler crate to link in rusts's sysinfo crate and get whatever system information you want on whatever arch/os you want though since it supports basically everything with a modern OS?

@PragTob
Copy link
Member

PragTob commented Dec 5, 2024

@OvermindDL1 hey there, long time no see! Glad to see you and thanks for stopping by! 💚

Benchee's System just wants to get the CPU and RAM as best as possible. I believe/think you helped create it at least with comments and knowledge - 7 years or so back :) Don't wanna go sledgehammer, I'll probably try power shell just not overly familiar with it. After doing this might also be a good point to finally extract Benchee.System into its own Systemex that just gets this data.

@OvermindDL1
Copy link

Well you might see what observer displays about the cpu and ram, that will at least be built in functionality, if it contains everything you need then check it's source to see how it gets it? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants