19 lines
779 B
PowerShell
19 lines
779 B
PowerShell
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
|
|
|
$null = New-Module {
|
|
$path = "$env:LOCALAPPDATA/LGHUB";
|
|
$softwareName = "LGHub";
|
|
|
|
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() };
|
|
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i!settings.db", "-i!icon_cache"));
|
|
|
|
if ($lghub) {
|
|
& "$lghub";
|
|
}
|
|
}
|
|
}
|