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