Kill all processes related to LGHub during restore

This commit is contained in:
Manuel Thalmann 2024-03-24 17:47:41 +01:00
parent 72615ab002
commit c781134141

View file

@ -17,7 +17,7 @@ $null = New-Module {
$hubName = Get-LogitechGHUBName; $hubName = Get-LogitechGHUBName;
$lghubPath = $(Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq $hubName })[0].Path; $lghubPath = $(Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq $hubName })[0].Path;
$mainProcesses = Get-Process | Where-Object { @($hubName) -contains [System.IO.Path]::GetFileName($_.Path) -and $( $mainProcesses = Get-Process | Where-Object { @("lghub_agent.exe", $hubName) -contains [System.IO.Path]::GetFileName($_.Path) -and $(
$_.Parent.ProcessName -eq "explorer" -or $null -eq $_.Parent) }; $_.Parent.ProcessName -eq "explorer" -or $null -eq $_.Parent) };
$null = $mainProcesses | Foreach-Object { $_.Kill($true) }; $null = $mainProcesses | Foreach-Object { $_.Kill($true) };