From d7a4aaf6b73df210f75c94345d102e909e2b27cd Mon Sep 17 00:00:00 2001 From: Caleb <53413881+CK6853@users.noreply.github.com> Date: Wed, 30 Oct 2024 18:40:43 +1000 Subject: [PATCH] fix(windows): use Get-WmiObject instead of deprecated wmic Signed-off-by: Caleb <53413881+CK6853@users.noreply.github.com> --- _webi/package-install.tpl.ps1 | 2 +- vcruntime/install.ps1 | 2 +- webi/webi-pwsh.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_webi/package-install.tpl.ps1 b/_webi/package-install.tpl.ps1 index f833717..33328d7 100644 --- a/_webi/package-install.tpl.ps1 +++ b/_webi/package-install.tpl.ps1 @@ -88,7 +88,7 @@ function Get-UserAgent { IF ($my_arch -eq "AMD64") { # Because PowerShell is sometimes AMD64 on Windows 10 ARM # See https://oofhours.com/2020/02/04/powershell-on-windows-10-arm64/ - $my_os_arch = wmic os get osarchitecture + $my_os_arch = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture # Using -clike because of the trailing newline IF ($my_os_arch -clike "ARM 64*") { diff --git a/vcruntime/install.ps1 b/vcruntime/install.ps1 index 197b533..647349d 100644 --- a/vcruntime/install.ps1 +++ b/vcruntime/install.ps1 @@ -7,7 +7,7 @@ IF ($my_arch -eq $null -or $my_arch -eq "") { IF ($my_arch -eq "AMD64") { # Because PowerShell isn't ARM yet. # See https://oofhours.com/2020/02/04/powershell-on-windows-10-arm64/ - $my_os_arch = wmic os get osarchitecture + $my_os_arch = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture # Using -clike because of the trailing newline IF ($my_os_arch -clike "ARM 64*") { diff --git a/webi/webi-pwsh.ps1 b/webi/webi-pwsh.ps1 index d7edb77..db5e65f 100755 --- a/webi/webi-pwsh.ps1 +++ b/webi/webi-pwsh.ps1 @@ -90,7 +90,7 @@ function Get-UserAgent { IF ($my_arch -eq "AMD64") { # Because PowerShell is sometimes AMD64 on Windows 10 ARM # See https://oofhours.com/2020/02/04/powershell-on-windows-10-arm64/ - $my_os_arch = wmic os get osarchitecture + $my_os_arch = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture # Using -clike because of the trailing newline IF ($my_os_arch -clike "ARM 64*") {