commit
92f679eb93
|
@ -28,13 +28,14 @@ if ( $psversionTable.PSEdition -eq "core" ) {
|
||||||
import-Module -name Appx -UseWIndowsPowershell -WarningAction:SilentlyContinue
|
import-Module -name Appx -UseWIndowsPowershell -WarningAction:SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
$Script:WAUConfiguratorVersion = Get-Content ".\Winget-AutoUpdate\Version.txt"
|
$Script:WorkingDir = (Get-Location).Path
|
||||||
|
$Script:WAUConfiguratorVersion = Get-Content "$WorkingDir\Winget-AutoUpdate\Version.txt"
|
||||||
|
|
||||||
|
|
||||||
<# FUNCTIONS #>
|
<# FUNCTIONS #>
|
||||||
|
|
||||||
. ".\Winget-AutoUpdate\functions\Update-WinGet.ps1"
|
. "$WorkingDir\Winget-AutoUpdate\functions\Update-WinGet.ps1"
|
||||||
. ".\Winget-AutoUpdate\functions\Get-WingetCmd.ps1"
|
. "$WorkingDir\Winget-AutoUpdate\functions\Get-WingetCmd.ps1"
|
||||||
|
|
||||||
#Function to start or update popup
|
#Function to start or update popup
|
||||||
Function Start-PopUp ($Message) {
|
Function Start-PopUp ($Message) {
|
||||||
|
@ -183,12 +184,12 @@ function Start-Installations {
|
||||||
if ($WAUUseWhiteList) {
|
if ($WAUUseWhiteList) {
|
||||||
$WAUParameters += "-UseWhiteList "
|
$WAUParameters += "-UseWhiteList "
|
||||||
if ($WAUListPath) {
|
if ($WAUListPath) {
|
||||||
Copy-Item $WAUListPath -Destination ".\included_apps.txt" -Force -ErrorAction SilentlyContinue
|
Copy-Item $WAUListPath -Destination "$WorkingDir\included_apps.txt" -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($WAUListPath) {
|
if ($WAUListPath) {
|
||||||
Copy-Item $WAUListPath -Destination ".\excluded_apps.txt" -Force -ErrorAction SilentlyContinue
|
Copy-Item $WAUListPath -Destination "$WorkingDir\excluded_apps.txt" -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($WAUDesktopShortcut) {
|
if ($WAUDesktopShortcut) {
|
||||||
|
@ -202,7 +203,7 @@ function Start-Installations {
|
||||||
}
|
}
|
||||||
|
|
||||||
#Install Winget-Autoupdate
|
#Install Winget-Autoupdate
|
||||||
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command ""& '.\Winget-AutoUpdate-Install.ps1' $WAUParameters""" -Wait -Verb RunAs
|
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command ""& '$WorkingDir\Winget-AutoUpdate-Install.ps1' $WAUParameters""" -Wait -Verb RunAs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,7 +276,7 @@ function Start-Uninstallations ($AppToUninstall) {
|
||||||
|
|
||||||
#Run Winget-Install -Uninstall
|
#Run Winget-Install -Uninstall
|
||||||
$AppsToUninstall = "'$($AppToUninstall -join "','")'"
|
$AppsToUninstall = "'$($AppToUninstall -join "','")'"
|
||||||
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `".\Winget-AutoUpdate\Winget-Install.ps1 -AppIDs $AppsToUninstall -Uninstall`"" -Wait -Verb RunAs
|
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `"$WorkingDir\Winget-AutoUpdate\Winget-Install.ps1 -AppIDs $AppsToUninstall -Uninstall`"" -Wait -Verb RunAs
|
||||||
|
|
||||||
Close-PopUp
|
Close-PopUp
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,9 +299,8 @@ if (Test-Network) {
|
||||||
if ($outdated -like "No update found.*") {
|
if ($outdated -like "No update found.*") {
|
||||||
Write-ToLog "$outdated" "cyan"
|
Write-ToLog "$outdated" "cyan"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Run only if $outdated is populated!
|
#Run only if $outdated is populated!
|
||||||
if ($outdated) {
|
else {
|
||||||
#Log list of app to update
|
#Log list of app to update
|
||||||
foreach ($app in $outdated) {
|
foreach ($app in $outdated) {
|
||||||
#List available updates
|
#List available updates
|
||||||
|
|
|
@ -13,8 +13,11 @@ function Get-WingetOutdatedApps {
|
||||||
|
|
||||||
#Start Conversion of winget format to an array. Check if "-----" exists (Winget Error Handling)
|
#Start Conversion of winget format to an array. Check if "-----" exists (Winget Error Handling)
|
||||||
if (!($upgradeResult -match "-----")) {
|
if (!($upgradeResult -match "-----")) {
|
||||||
return "No update found. Winget upgrade output:`n$upgradeResult"
|
|
||||||
|
return "No update found. 'Winget upgrade' output:`n$upgradeResult"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
#Split winget output to lines
|
#Split winget output to lines
|
||||||
$lines = $upgradeResult.Split([Environment]::NewLine) | Where-Object { $_ }
|
$lines = $upgradeResult.Split([Environment]::NewLine) | Where-Object { $_ }
|
||||||
|
@ -73,4 +76,7 @@ function Get-WingetOutdatedApps {
|
||||||
}
|
}
|
||||||
|
|
||||||
return $upgradeList | Sort-Object { Get-Random }
|
return $upgradeList | Sort-Object { Get-Random }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue