From c1efd614e8d433db2ed006a291adf29b6aac8ff8 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Thu, 27 Jan 2022 07:05:46 +0530 Subject: [PATCH] Use Get-Module instead of Get-InstalledModule --- src/scripts/win32.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 112d97f1..ffcc91cc 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -238,7 +238,7 @@ if($env:RUNNER -eq 'self-hosted' -or (-not($env:ImageOS) -and -not($env:ImageVer Start-Sleep 1 exit 1 } - if ((Get-InstalledModule).Name -notcontains 'VcRedist') { + if ($null -eq (Get-Module -ListAvailable -Name VcRedist)) { Install-Module -Name VcRedist -Force } New-Item $php_dir -Type Directory -Force > $null 2>&1 @@ -275,7 +275,7 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) { $status = "Installed" $extra_version = "" if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) { - if ($version -lt '7.0' -and (Get-InstalledModule).Name -notcontains 'VcRedist') { + if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) { Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1 } try {