From 73a070e28633b55b8873707dd529ac5cfd09364d Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 9 Jun 2023 18:51:20 +0200 Subject: [PATCH] Fix broken LGHUB backup --- scripts/Windows/Software/LGHub/Manage.ps1 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/Windows/Software/LGHub/Manage.ps1 b/scripts/Windows/Software/LGHub/Manage.ps1 index 11176d65..0f05189b 100644 --- a/scripts/Windows/Software/LGHub/Manage.ps1 +++ b/scripts/Windows/Software/LGHub/Manage.ps1 @@ -6,18 +6,16 @@ $null = New-Module { function Invoke-BackupLGHub([Context] $context) { $hubName = "lghub.exe"; + $hubPath = $(Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq $hubName })[0].Path; - $mainProcess = Get-Process | Where-Object { - [System.IO.Path]::GetFileName($_.Path) -eq "$hubName" -and - $_.Parent.ProcessName -eq "explorer" - }; + $mainProcesses = Get-Process | Where-Object { @($hubName, "lghub_system_tray.exe") -contains [System.IO.Path]::GetFileName($_.Path) -and $( + $_.Parent.ProcessName -eq "explorer" -or $null -eq $_.Parent) }; - $lghub = $mainProcess.Path; - $mainProcess | Foreach-Object { $_.Kill($true) }; + $mainProcesses | Foreach-Object { $_.Kill($true) }; $context.Backup($path, $context.SoftwareArchive($softwareName), @("-i!settings.db", "-i!icon_cache")); - if ($lghub) { - Start-Process $lghub; + if ($hubPath) { + Start-Process $hubPath; } } }