mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-23 06:08:36 +01:00
Update install-basic-apps.ps1
This commit is contained in:
parent
309af499f6
commit
d943498eaa
@ -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"
|
||||
|
|
@ -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])"
|
||||
|
Loading…
Reference in New Issue
Block a user