From 36ff8879a0cba5243a6b68996998561caa448e73 Mon Sep 17 00:00:00 2001 From: "David Gonzalez Martinez (DHL Supply Chain), external" Date: Mon, 4 Nov 2024 16:05:49 +0100 Subject: [PATCH] Refactoring --- InstallAppsWinget.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InstallAppsWinget.ps1 b/InstallAppsWinget.ps1 index 3aab8ef..e381e12 100644 --- a/InstallAppsWinget.ps1 +++ b/InstallAppsWinget.ps1 @@ -9,7 +9,7 @@ if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $releases = Invoke-RestMethod -uri $releases_url - $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith('msixbundle') } | Select -First 1 + $latestRelease = $releases.assets | Where-Object { $_.browser_download_url.EndsWith('msixbundle') } | Select-Object -First 1 "Installing winget from $($latestRelease.browser_download_url)" Add-AppxPackage -Path $latestRelease.browser_download_url @@ -59,7 +59,7 @@ Foreach ($app in $apps) { $listApp = winget list --exact -q $app.name --accept-source-agreements if (![String]::Join("", $listApp).Contains($app.name)) { Write-host "Installing:" $app.name - if ($app.source -ne $null) { + if ($null -ne $app.source) { winget install --exact --silent $app.name --source $app.source --accept-package-agreements } else {