Minor changes
parent
3f84a5cc6e
commit
21910e63de
33
Gui.ps1
33
Gui.ps1
|
@ -82,7 +82,9 @@ function Get-WingetAppInfo ($SearchApp) {
|
||||||
|
|
||||||
#Start Convertion of winget format to an array. Check if "-----" exists
|
#Start Convertion of winget format to an array. Check if "-----" exists
|
||||||
if (!($AppResult -match "-----")) {
|
if (!($AppResult -match "-----")) {
|
||||||
Write-Host "No application found."
|
Start-PopUp "No application found!"
|
||||||
|
Start-Sleep 2
|
||||||
|
Close-PopUp
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +187,7 @@ function Start-Installations {
|
||||||
}
|
}
|
||||||
|
|
||||||
#Install Winget-Autoupdate
|
#Install Winget-Autoupdate
|
||||||
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `"$PSScriptRoot\Winget-AutoUpdate-Install.ps1 $WAUParameters`"" -Wait -Verb RunAs
|
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command ""& '$PSScriptRoot\Winget-AutoUpdate-Install.ps1' $WAUParameters""" -Wait -Verb RunAs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,7 +242,7 @@ function Start-Installations {
|
||||||
if ($PopUpWindow) {
|
if ($PopUpWindow) {
|
||||||
#Installs finished
|
#Installs finished
|
||||||
Start-PopUp "Done!"
|
Start-PopUp "Done!"
|
||||||
Start-Sleep 1
|
Start-Sleep 2
|
||||||
#Close Popup
|
#Close Popup
|
||||||
Close-PopUp
|
Close-PopUp
|
||||||
}
|
}
|
||||||
|
@ -272,8 +274,8 @@ function Get-WAUInstallStatus {
|
||||||
$WAUInstalled = $true
|
$WAUInstalled = $true
|
||||||
}
|
}
|
||||||
elseif ($WAUVersion) {
|
elseif ($WAUVersion) {
|
||||||
$WAULabelText = "WAU is currently installed (v$WAUVersion) but in another version!"
|
$WAULabelText = "WAU is currently installed but in a different version - v$WAUVersion"
|
||||||
$WAUStatus = "Orange"
|
$WAUStatus = "DarkOrange"
|
||||||
$WAUInstalled = $true
|
$WAUInstalled = $true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -623,7 +625,9 @@ function Start-InstallGUI {
|
||||||
$response = $SaveFileDialog.ShowDialog() # $response can return OK or Cancel
|
$response = $SaveFileDialog.ShowDialog() # $response can return OK or Cancel
|
||||||
if ( $response -eq 'OK' ) {
|
if ( $response -eq 'OK' ) {
|
||||||
$AppListBox.Items | Out-File $SaveFileDialog.FileName -Append
|
$AppListBox.Items | Out-File $SaveFileDialog.FileName -Append
|
||||||
Write-Host "File saved to:`n$($SaveFileDialog.FileName)"
|
Start-PopUp "File saved to:`n$($SaveFileDialog.FileName)"
|
||||||
|
Start-Sleep 2
|
||||||
|
Close-PopUp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -667,7 +671,7 @@ function Start-InstallGUI {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Start-PopUp "Please select apps to uninstall..."
|
Start-PopUp "Please select apps to uninstall..."
|
||||||
Start-Sleep 1
|
Start-Sleep 2
|
||||||
Close-PopUp
|
Close-PopUp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -686,15 +690,14 @@ function Start-InstallGUI {
|
||||||
|
|
||||||
$LogButton.add_click(
|
$LogButton.add_click(
|
||||||
{
|
{
|
||||||
if (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\") {
|
try {
|
||||||
$LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation
|
$LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocatifon
|
||||||
Start-Process "$LogPath\Logs"
|
Start-Process "$LogPath\Logs"
|
||||||
}
|
}
|
||||||
elseif (Test-Path "$env:programdata\Winget-AutoUpdate\Logs") {
|
catch {
|
||||||
Start-Process "$env:programdata\Winget-AutoUpdate\Logs"
|
Start-PopUp "Log location not found."
|
||||||
}
|
Start-Sleep 2
|
||||||
else {
|
Close-PopUp
|
||||||
Write-Host "Log location not found."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -704,7 +707,7 @@ function Start-InstallGUI {
|
||||||
##
|
##
|
||||||
$WAUConfiguratorLinkLabel.Add_PreviewMouseDown(
|
$WAUConfiguratorLinkLabel.Add_PreviewMouseDown(
|
||||||
{
|
{
|
||||||
[System.Diagnostics.Process]::Start("https://github.com/Romanitho/Winget-Install-GUI")
|
[System.Diagnostics.Process]::Start("https://github.com/Romanitho/Winget-AutoUpdate")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ function Install-WingetAutoUpdate {
|
||||||
Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
||||||
|
|
||||||
# Settings for the scheduled task for Updates (System)
|
# Settings for the scheduled task for Updates (System)
|
||||||
|
Write-ToLog "-> Installing WAU scheduled tasks"
|
||||||
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($WAUinstallPath)\winget-upgrade.ps1`""
|
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($WAUinstallPath)\winget-upgrade.ps1`""
|
||||||
$taskTriggers = @()
|
$taskTriggers = @()
|
||||||
if ($UpdatesAtLogon) {
|
if ($UpdatesAtLogon) {
|
||||||
|
@ -249,6 +250,7 @@ function Install-WingetAutoUpdate {
|
||||||
$task.SetSecurityDescriptor($sec, 0)
|
$task.SetSecurityDescriptor($sec, 0)
|
||||||
|
|
||||||
# Configure Reg Key
|
# Configure Reg Key
|
||||||
|
Write-ToLog "-> Setting Registry config"
|
||||||
New-Item $regPath -Force | Out-Null
|
New-Item $regPath -Force | Out-Null
|
||||||
New-ItemProperty $regPath -Name DisplayName -Value "Winget-AutoUpdate (WAU)" -Force | Out-Null
|
New-ItemProperty $regPath -Name DisplayName -Value "Winget-AutoUpdate (WAU)" -Force | Out-Null
|
||||||
New-ItemProperty $regPath -Name DisplayIcon -Value "C:\Windows\System32\shell32.dll,-16739" -Force | Out-Null
|
New-ItemProperty $regPath -Name DisplayIcon -Value "C:\Windows\System32\shell32.dll,-16739" -Force | Out-Null
|
||||||
|
@ -339,7 +341,12 @@ function Install-WingetAutoUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
#Add 1 to counter file
|
#Add 1 to counter file
|
||||||
|
try {
|
||||||
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUVersion)/WAU_InstallCounter" | Out-Null
|
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUVersion)/WAU_InstallCounter" | Out-Null
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-ToLog "-> Not able to report installation." "Yellow"
|
||||||
|
}
|
||||||
|
|
||||||
Write-ToLog "-> WAU Installation succeeded!`n" "Green"
|
Write-ToLog "-> WAU Installation succeeded!`n" "Green"
|
||||||
Start-sleep 1
|
Start-sleep 1
|
||||||
|
|
|
@ -57,24 +57,6 @@ function Invoke-PostUpdateActions {
|
||||||
Write-ToLog "-> MaxLogFiles/MaxLogSize setting was missing. Fixed with 3/1048576 (in bytes, default is 1048576 = 1 MB)."
|
Write-ToLog "-> MaxLogFiles/MaxLogSize setting was missing. Fixed with 3/1048576 (in bytes, default is 1048576 = 1 MB)."
|
||||||
}
|
}
|
||||||
|
|
||||||
#Set WAU_ListPath if not set
|
|
||||||
$ListPath = Get-ItemProperty $regPath -Name WAU_ListPath -ErrorAction SilentlyContinue
|
|
||||||
if (!$ListPath) {
|
|
||||||
New-ItemProperty $regPath -Name WAU_ListPath -Force | Out-Null
|
|
||||||
|
|
||||||
#log
|
|
||||||
Write-ToLog "-> ListPath setting was missing. Fixed with empty string."
|
|
||||||
}
|
|
||||||
|
|
||||||
#Set WAU_ModsPath if not set
|
|
||||||
$ModsPath = Get-ItemProperty $regPath -Name WAU_ModsPath -ErrorAction SilentlyContinue
|
|
||||||
if (!$ModsPath) {
|
|
||||||
New-ItemProperty $regPath -Name WAU_ModsPath -Force | Out-Null
|
|
||||||
|
|
||||||
#log
|
|
||||||
Write-ToLog "-> ModsPath setting was missing. Fixed with empty string."
|
|
||||||
}
|
|
||||||
|
|
||||||
#Security check
|
#Security check
|
||||||
Write-ToLog "-> Checking Mods Directory:" "yellow"
|
Write-ToLog "-> Checking Mods Directory:" "yellow"
|
||||||
$Protected = Invoke-DirProtect "$($WAUConfig.InstallLocation)\mods"
|
$Protected = Invoke-DirProtect "$($WAUConfig.InstallLocation)\mods"
|
||||||
|
@ -183,7 +165,12 @@ function Invoke-PostUpdateActions {
|
||||||
$Script:WAUConfig = Get-WAUConfig
|
$Script:WAUConfig = Get-WAUConfig
|
||||||
|
|
||||||
#Add 1 to counter file
|
#Add 1 to counter file
|
||||||
|
try {
|
||||||
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUConfig.DisplayVersion)/WAU_InstallCounter" | Out-Null
|
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUConfig.DisplayVersion)/WAU_InstallCounter" | Out-Null
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-ToLog "-> Not able to report installation." "Yellow"
|
||||||
|
}
|
||||||
|
|
||||||
#log
|
#log
|
||||||
Write-ToLog "Post Update actions finished" "green"
|
Write-ToLog "Post Update actions finished" "green"
|
||||||
|
|
Loading…
Reference in New Issue