Add files via upload

pull/2/head v1.1.2
Romanitho 2022-01-18 23:38:56 +01:00 committed by GitHub
parent ad053aec15
commit 3ec03ad26a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -1,7 +1,7 @@
#Send Notif Script #Send Notif Script
#get xml notif config #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} if (!($NotifConf)) {break}
#Load Assemblies #Load Assemblies

View File

@ -92,10 +92,13 @@ function Get-WingetOutdated {
} }
#Get WinGet Location to run as system #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 #WinGet < 1.17
$script:upgradecmd = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\AppInstallerCLI.exe" | Select -ExpandProperty Path $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"){ elseif (Test-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\winget.exe"){
#WinGet > 1.17 #WinGet > 1.17
@ -106,16 +109,20 @@ function Get-WingetOutdated {
return 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 $upgradeResult = & $upgradecmd upgrade | Out-String
#Start Convertion of winget format to an array
if (!($upgradeResult -match "-----")){ if (!($upgradeResult -match "-----")){
return return
} }
$lines = $upgradeResult.Split([Environment]::NewLine) $lines = $upgradeResult.Split([Environment]::NewLine)
# Find the line that starts with ------ # Find the line that starts with "------"
$fl = 0 $fl = 0
while (-not $lines[$fl].StartsWith("-----")) while (-not $lines[$fl].StartsWith("-----"))
{ {