Skip to content

Instantly share code, notes, and snippets.

@davlgd
Last active May 30, 2020
Embed
What would you like to do?
PowerShell scripts to make WinGet great again
<# Script to install multiple applications in one command line through WinGet
You can modify bootstrapArray value and use "--bootstrap" argument to bootstrap a new machine
Don't forget to change ExecutionPolicy to execute this script
Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope CurrentUser #>
$bootstrapArray = @("vlc", "7zip", "cpu-z", "coretemp")
if ((New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
if ($args[0] -ne "--bootstrap") { $bootstrapArray = $args }
$bootstrapArray | ForEach-Object { winget install -h $_ }
}
else { Write-Output "You need elevated privileges to run WinGet install script."}
<# Script to check what's new or modified in public WinGet's manifests list
Don't forget to change ExecutionPolicy to execute this script
Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope CurrentUser #>
$url = "https://api.github.com/repos/microsoft/winget-pkgs/contents/manifests"
$fileName = "WinGetApps.txt"
$storedList = @()
$response = Invoke-WebRequest $url
$init = Test-Path($fileName)
if ($init){ $storedList = Get-Content -Raw -Path $fileName | ConvertFrom-Json }
$response.Content | Out-File $fileName
if (-Not $init) {
Write-Output "WinGet public manifests list initialized."
return
}
$apps = $response.Content | ConvertFrom-JSON
Write-Output ""
Write-Output "WinGet public manifests list modifications :"
Write-Output "============================================"
Compare-Object $storedList $apps -Property name, path, sha, html_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment