diff --git a/wingetInstaller.ps1 b/wingetInstaller.ps1 index 50cac6737ffd3984adf2ae83fd87147b15445498..67f5fbeca0482daaf7fdc1342f804bfa00431ad2 100644 --- a/wingetInstaller.ps1 +++ b/wingetInstaller.ps1 @@ -1,4 +1,4 @@ -# Self-elevate the script if required +# Self-elevate the script if required if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { # PowerShell 5 and later @@ -98,7 +98,7 @@ foreach ($app in $applications) { } } else { Write-Host "$app is not installed. Installing..." -ForegroundColor Green - winget install --id $app --silent --accept-package-agreements --accept-source-agreements + winget install --scope machine --id $app --silent --accept-package-agreements --accept-source-agreements # Verify installation if (Test-ApplicationInstalled -AppId $app) {