Fix broken LGHUB backup
This commit is contained in:
parent
3db7fb1ff9
commit
73a070e286
1 changed files with 6 additions and 8 deletions
|
@ -6,18 +6,16 @@ $null = New-Module {
|
||||||
|
|
||||||
function Invoke-BackupLGHub([Context] $context) {
|
function Invoke-BackupLGHub([Context] $context) {
|
||||||
$hubName = "lghub.exe";
|
$hubName = "lghub.exe";
|
||||||
|
$hubPath = $(Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq $hubName })[0].Path;
|
||||||
|
|
||||||
$mainProcess = Get-Process | Where-Object {
|
$mainProcesses = Get-Process | Where-Object { @($hubName, "lghub_system_tray.exe") -contains [System.IO.Path]::GetFileName($_.Path) -and $(
|
||||||
[System.IO.Path]::GetFileName($_.Path) -eq "$hubName" -and
|
$_.Parent.ProcessName -eq "explorer" -or $null -eq $_.Parent) };
|
||||||
$_.Parent.ProcessName -eq "explorer"
|
|
||||||
};
|
|
||||||
|
|
||||||
$lghub = $mainProcess.Path;
|
$mainProcesses | Foreach-Object { $_.Kill($true) };
|
||||||
$mainProcess | Foreach-Object { $_.Kill($true) };
|
|
||||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i!settings.db", "-i!icon_cache"));
|
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i!settings.db", "-i!icon_cache"));
|
||||||
|
|
||||||
if ($lghub) {
|
if ($hubPath) {
|
||||||
Start-Process $lghub;
|
Start-Process $hubPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue