Update install-basic-apps.ps1

This commit is contained in:
Markus Fleschutz 2022-12-28 13:24:05 +01:00
parent 309af499f6
commit d943498eaa
2 changed files with 10 additions and 8 deletions

View File

@ -2,7 +2,7 @@ APPNAME, CATEGORY, APPID
"7-Zip", "file tool", "XPDNKVCX4QD2DC"
"Aquile Reader", "ebook reader", "9P08T4JLTQNK"
"CrystalDiskInfo", "HDD/SSD tool", "XP8K4RGX25G3GM"
"Google Chrome", " desktop browser", "Google.Chrome"
"Google Chrome", "desktop browser", "Google.Chrome"
"Dopamine", "audio player", "Digimezzo.Dopamine.2"
"Dropbox", "file sync", "Dropbox.Dropbox"
"Git for Windows", "code management", "Git.Git"

1 APPNAME CATEGORY APPID
2 7-Zip file tool XPDNKVCX4QD2DC
3 Aquile Reader ebook reader 9P08T4JLTQNK
4 CrystalDiskInfo HDD/SSD tool XP8K4RGX25G3GM
5 Google Chrome desktop browser desktop browser Google.Chrome
6 Dopamine audio player Digimezzo.Dopamine.2
7 Dropbox file sync Dropbox.Dropbox
8 Git for Windows code management Git.Git

View File

@ -15,31 +15,33 @@
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
"⏳ Step 1 - Loading table from Data/basic-apps.csv..."
"⏳ Step 1 - Loading Data/basic-apps.csv..."
$Table = Import-CSV "$PSScriptRoot/../Data/basic-apps.csv"
$NumEntries = $Table.count
Write-Host " About to install $NumEntries apps: " -NoNewline
Write-Host " The following $NumEntries basic apps will be installed or upgraded: " -NoNewline
foreach($Row in $Table) {
[string]$AppName = $Row.AppName
Write-Host "$AppName, " -NoNewline
}
""
"Press <Control> <C> to abort, otherwise the installation will start..."
sleep -s 3
"Press <Control> <C> to abort, otherwise the installation will start in 10 seconds..."
sleep -s 10
[int]$Step = 2
[int]$Failed = 0
foreach($Row in $Table) {
[string]$AppName = $Row.AppName
[string]$Category = $Row.Category
[string]$AppID = $Row.AppID
"Step $Step/$($NumEntries + 1) - Installing $AppName ($Category)..."
"($Step/$($NumEntries + 1)) Installing $AppName ($Category)..."
& winget install --id $AppID --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' for $AppName failed" }
if ($lastExitCode -ne "0") { Write-Warning "'winget install' for $AppName failed"; $Failed++ }
$Step++
}
[int]$Installed = ($NumEntries - $Failed)
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ installed $NumEntries apps in $Elapsed sec"
"✔️ installed $Installed basic apps in $Elapsed sec. ($Failed failed)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"