Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Romanitho authored Jan 18, 2022
1 parent ad053ae commit 3ec03ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion winget-update/winget-notify.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Send Notif Script

#get xml notif config
[xml]$NotifConf = Get-Content "$PSScriptRoot\notif.xml" -Encoding UTF8
[xml]$NotifConf = Get-Content "$PSScriptRoot\notif.xml" -Encoding UTF8 -ErrorAction SilentlyContinue
if (!($NotifConf)) {break}

#Load Assemblies
Expand Down
15 changes: 11 additions & 4 deletions winget-update/winget-upgrade.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,13 @@ function Get-WingetOutdated {
}

#Get WinGet Location to run as system
if (Test-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\AppInstallerCLI.exe"){
$WingetCmd = Get-Command winget.exe -ErrorAction SilentlyContinue
if ($WingetCmd){
$script:upgradecmd = $WingetCmd.Source
}
elseif (Test-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\AppInstallerCLI.exe"){
#WinGet < 1.17
$script:upgradecmd = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\AppInstallerCLI.exe" | Select -ExpandProperty Path

}
elseif (Test-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\winget.exe"){
#WinGet > 1.17
Expand All @@ -106,16 +109,20 @@ function Get-WingetOutdated {
return
}

& $upgradecmd upgrade * --accept-source-agreements | Out-Null
#Run winget to list apps and accept source agrements (necessary on first run)
& $upgradecmd list --accept-source-agreements | Out-Null

#Get list of available upgrades on winget format
$upgradeResult = & $upgradecmd upgrade | Out-String

#Start Convertion of winget format to an array
if (!($upgradeResult -match "-----")){
return
}

$lines = $upgradeResult.Split([Environment]::NewLine)

# Find the line that starts with ------
# Find the line that starts with "------"
$fl = 0
while (-not $lines[$fl].StartsWith("-----"))
{
Expand Down

0 comments on commit 3ec03ad

Please sign in to comment.