New
#1
I need a script to SILENTLY install winget
I was trying to mount a script that installs winget, install apps that I need, then installs lastest Microsoft Updates and auto-reboot the machine when finishes. I got pretty far of my goal. I'm stuck on getting to install winget silently. I only could install winget from msstore, but they pop-up asking to click Yes to continue (therego, not silently). Can anyone help?
I must mention that NONE of the code that I use is from me. I'm below newbie on script powershell. I only see community scripts and adapt to my need.
That's the screen that shows asking me to click update in order the script to continue:Code:# Check if winget is installed Write-Host "Checking if Winget is Installed..." if (Test-Path ~\AppData\Local\Microsoft\WindowsApps\winget.exe) { #Checks if winget executable exists and if the Windows Version is 1809 or higher Write-Host "Winget Already Installed" } else { #Gets the computer's information $ComputerInfo = Get-ComputerInfo #Gets the Windows Edition $OSName = if ($ComputerInfo.OSName) { $ComputerInfo.OSName }else { $ComputerInfo.WindowsProductName } if (((($OSName.IndexOf("LTSC")) -ne -1) -or ($OSName.IndexOf("Server") -ne -1)) -and (($ComputerInfo.WindowsVersion) -ge "1809")) { Write-Host "Running Alternative Installer for LTSC/Server Editions" # Switching to winget-install from PSGallery from asheroto # Source: https://github.com/asheroto/winget-in... Start-Process powershell.exe -Verb RunAs -ArgumentList "-command irm https://raw.githubusercontent.com/ChrisTitusTech/winutil/$BranchToUse/winget.ps1 | iex | Out-Host" -WindowStyle Normal } elseif (((Get-ComputerInfo).WindowsVersion) -lt "1809") { #Checks if Windows Version is too old for winget Write-Host "Winget is not supported on this version of Windows (Pre-1809)" } else { #Installing Winget from the Microsoft Store Write-Host "Winget not found, installing it now." Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget" $nid = (Get-Process AppInstaller).Id Wait-Process -Id $nid Write-Host "Winget Installed" } }