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

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

Closed
CK6853 opened this issue Oct 30, 2024 · 0 comments · Fixed by #912
Closed

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

CK6853 opened this issue Oct 30, 2024 · 0 comments · Fixed by #912
Labels
bug Something isn't working

Comments

@CK6853
Copy link
Contributor

CK6853 commented Oct 30, 2024

Pretty sure I know what went wrong and how to fix, but I'll answer the standard questions anyway and put my own thoughts at the bottom.

What were you trying to install (or what else went wrong)?

While running a WebInstall for Caddy, webi-pwsh.ps1 had an error "The term 'wmic' is not recognized..."

What exactly did you do?

On a machine running Windows 11. Ran "curl.exe https://webi.ms/caddy | powershell" as per https://webinstall.dev/caddy/

What went wrong?

image

Which OS did you try on?

Windows 11 (Business, 24H2), through WSL (Ubuntu 24.04.1)

What type of computer (i.e. laptop, desktop, Raspberry Pi)?

Laptop

My fix

As per this page, WMIC is deprecated in newer versions of Windows (though WMI itself is not). I solved the issue locally by replacing the line wmic os get osarchitecture with (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture in both webi/webi-pwsh.ps1 and _webi/package-install.tpl.ps1. 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.

@CK6853 CK6853 added the bug Something isn't working label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant