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) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue