parent
ad053aec15
commit
3ec03ad26a
|
@ -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
|
||||||
|
|
|
@ -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("-----"))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue