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

fix - wmic deprecated #912

Merged
merged 2 commits into from
Nov 10, 2024
Merged

fix - wmic deprecated #912

merged 2 commits into from
Nov 10, 2024

Conversation

CK6853
Copy link
Contributor

@CK6853 CK6853 commented Oct 30, 2024

fixes #911

WMIC deprecated on Windows 11 and later versions of Windows 10 as per https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmic

This alternative works on both older and newer versions of Powershell, and outputs in a similar enough format that related code works with no additional changes.

@coolaj86 coolaj86 force-pushed the wmic-deprecated branch 2 times, most recently from 54b9ae4 to 892fa17 Compare November 10, 2024 07:21
@coolaj86
Copy link
Member

@CK6853 Thank you very much for this!

Copy link
Member

@coolaj86 coolaj86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested on Windows 10 x64 and Windows 11 ARM64.

LGTM.

@coolaj86
Copy link
Member

coolaj86 commented Nov 10, 2024

I was reading the article you linked to and some comments and found that (Get-CimInstance -ClassName Win32_OperatingSystem).OSArchitecture) no longer works in PowerShell Core.

So I added a commit to switch to (Get-CimInstance -ClassName Win32_OperatingSystem).OSArchitecture), which works in PowerShell 3+ (PowerShell 5 for Windows 10) as well as PowerShell Core 7.

Re: https://www.reddit.com/r/PowerShell/comments/17la4ur/getwmiobject_not_supported_anymore/

@coolaj86 coolaj86 merged commit c94b4cf into webinstall:main Nov 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] (Architecture checking) - WMIC deprecated in Windows 10 21H1 and Windows 11
2 participants