From c94b4cf5c7cc8ea5597b31bce3c73dca500dd2c6 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 10 Nov 2024 07:51:06 +0000 Subject: [PATCH] fix(windows): use Get-CimInstance instead of deprecated Get-WmiObject --- _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 33328d7bc..33d540e6a 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 = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture + $my_os_arch = (Get-CimInstance -ClassName 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 647349da4..b9c2c8719 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 = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture + $my_os_arch = (Get-CimInstance -ClassName 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 db5e65f99..4bf481abe 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 = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture + $my_os_arch = (Get-CimInstance -ClassName Win32_OperatingSystem).OSArchitecture # Using -clike because of the trailing newline IF ($my_os_arch -clike "ARM 64*") {