<# Uninstall-LogiSwitch.ps1 - remove LogiSwitch for the current Windows user. Stops the tray icon and watcher, removes the startup entry, deletes the installed files. Logitech software, devices and pairings are not touched. #> param([switch]$Quiet) $dst = Join-Path $env:LOCALAPPDATA 'LogiSwitch' Get-CimInstance Win32_Process -Filter "Name='powershell.exe'" | Where-Object { $_.CommandLine -match '\\LogiSwitch(Tray)?\.ps1' -and $_.ProcessId -ne $PID } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue } $startup = [Environment]::GetFolderPath('Startup') Remove-Item (Join-Path $startup 'LogiSwitch.lnk'), (Join-Path $startup 'LogiSwitch edge watcher.lnk') -ErrorAction SilentlyContinue # Delete the folder a moment after this script exits (it may be running from inside it). if (Test-Path $dst) { Start-Process -FilePath "$env:WINDIR\System32\cmd.exe" -ArgumentList "/c timeout /t 2 /nobreak >nul & rmdir /s /q `"$dst`"" -WindowStyle Hidden -WorkingDirectory $env:TEMP } if (-not $Quiet) { "LogiSwitch removed. (Installed files in $dst are deleted in a few seconds.)" }