. "$PSScriptRoot/../../Scripts/Context.ps1"; $null = New-Module { $path = "$env:LOCALAPPDATA/LGHUB"; $softwareName = "LGHub"; function Invoke-BackupLGHub([Context] $context) { $hubName = "lghub.exe"; $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) { Start-Process $lghub; } } }