@echo off rem DialeDesk - remocao completa (servico, arquivos, registros, firewall, rem atalhos, credenciais e configuracoes) para uma instalacao limpa. rem Dois cliques: pede administrador e roda o bloco PowerShell abaixo. setlocal net session >nul 2>&1 if errorlevel 1 ( powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -ArgumentList '\"USERPROFILE=%USERPROFILE%\"' -Verb RunAs" exit /b ) set "DIALE_SELF=%~f0" set "DIALE_ARG=%~1" powershell -NoProfile -ExecutionPolicy Bypass -Command "$s = Get-Content -Raw -LiteralPath $env:DIALE_SELF; iex ($s.Substring($s.LastIndexOf('#POWERSHELL#') + 12))" echo. pause exit /b #POWERSHELL# $ErrorActionPreference = 'SilentlyContinue' function Step($text) { Write-Host " - $text" -ForegroundColor Cyan } function Done($text) { Write-Host " $text" -ForegroundColor DarkGray } # Perfil do usuario que abriu o removedor (o UAC pode elevar com outra conta). $userProfile = $env:USERPROFILE if ($env:DIALE_ARG -like 'USERPROFILE=*') { $userProfile = $env:DIALE_ARG.Substring(12) } if (-not $userProfile -or -not (Test-Path -LiteralPath $userProfile)) { Write-Host 'Nao foi possivel identificar a pasta do usuario; nada foi removido.' -ForegroundColor Red return } $roaming = Join-Path $userProfile 'AppData\Roaming' $local = Join-Path $userProfile 'AppData\Local' Write-Host '' Write-Host 'DialeDesk - remocao completa' -ForegroundColor White Write-Host "Usuario: $userProfile" Write-Host '' Step 'Encerrando o DialeDesk' foreach ($name in 'DialeDesk', 'diale-app', 'diale-host', 'diale-server') { Get-Process -Name $name | Stop-Process -Force } Start-Sleep -Milliseconds 800 Step 'Removendo o servico DialeDesk' if (Get-Service -Name DialeDesk) { Stop-Service -Name DialeDesk -Force & sc.exe delete DialeDesk | Out-Null Done 'servico removido' } else { Done 'nenhum servico encontrado' } Get-Process -Name diale-host | Stop-Process -Force Start-Sleep -Milliseconds 800 Step 'Apagando pastas e arquivos' $paths = @( (Join-Path $env:ProgramFiles 'DialeDesk'), (Join-Path ${env:ProgramFiles(x86)} 'DialeDesk'), (Join-Path $env:ProgramData 'DialeDesk'), (Join-Path $local 'DialeDesk'), (Join-Path $local 'com.dialedesk.app'), (Join-Path $local 'com.dialedesk.portable'), (Join-Path $roaming 'com.dialedesk.app'), (Join-Path $roaming 'DialeDesk'), (Join-Path $env:PUBLIC 'Downloads\DialeDesk'), (Join-Path $userProfile 'Downloads\DialeDesk'), (Join-Path $env:PUBLIC 'dialedesk-install.log'), (Join-Path $env:PUBLIC 'Desktop\DialeDesk.lnk'), (Join-Path $userProfile 'Desktop\DialeDesk.lnk'), (Join-Path $env:ProgramData 'Microsoft\Windows\Start Menu\Programs\DialeDesk.lnk'), (Join-Path $env:ProgramData 'Microsoft\Windows\Start Menu\Programs\DialeDesk'), (Join-Path $roaming 'Microsoft\Windows\Start Menu\Programs\DialeDesk.lnk'), (Join-Path $roaming 'Microsoft\Windows\Start Menu\Programs\DialeDesk') ) foreach ($path in $paths) { if ($path -and (Test-Path -LiteralPath $path)) { Remove-Item -LiteralPath $path -Recurse -Force if (Test-Path -LiteralPath $path) { Done "NAO removido (em uso?): $path" } else { Done "removido: $path" } } } foreach ($temp in @($env:TEMP, (Join-Path $local 'Temp'))) { Get-ChildItem -LiteralPath $temp -Filter 'dialedesk*' | Remove-Item -Recurse -Force Get-ChildItem -LiteralPath $temp -Filter 'diale-*' | Remove-Item -Recurse -Force } Step 'Limpando o registro do Windows' $userSid = (New-Object System.Security.Principal.NTAccount((Split-Path $userProfile -Leaf))).Translate([System.Security.Principal.SecurityIdentifier]).Value $hkcu = if ($userSid -and (Test-Path "Registry::HKEY_USERS\$userSid")) { "Registry::HKEY_USERS\$userSid" } else { 'HKCU:' } $keys = @( 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\DialeDesk', 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\DialeDesk', "$hkcu\Software\Microsoft\Windows\CurrentVersion\Uninstall\DialeDesk", "$hkcu\Software\DialeDesk", "$hkcu\Software\com.dialedesk.app", "$hkcu\Software\Classes\diale" ) foreach ($key in $keys) { if (Test-Path $key) { Remove-Item -Path $key -Recurse -Force; Done "removido: $key" } } foreach ($root in "$hkcu\Software\Microsoft\Windows\CurrentVersion\Uninstall", 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall') { Get-ChildItem $root | Where-Object { (Get-ItemProperty $_.PSPath).DisplayName -like 'DialeDesk*' } | ForEach-Object { Remove-Item $_.PSPath -Recurse -Force; Done "removido: $($_.Name)" } } $run = "$hkcu\Software\Microsoft\Windows\CurrentVersion\Run" (Get-ItemProperty $run).PSObject.Properties | Where-Object { $_.Name -like '*iale*' } | ForEach-Object { Remove-ItemProperty -Path $run -Name $_.Name -Force; Done "inicio automatico removido: $($_.Name)" } # Ctrl+Alt+Del por software (ligado pelo servico): volta ao padrao do Windows. Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name SoftwareSASGeneration -Force Step 'Removendo regras de firewall' $rules = Get-NetFirewallRule -DisplayName 'DialeDesk*' $count = @($rules).Count $rules | Remove-NetFirewallRule Done "$count regra(s) removida(s)" Step 'Removendo senhas salvas (Gerenciador de Credenciais)' $targets = cmdkey /list | Select-String -Pattern 'Destino:|Target:' | ForEach-Object { ($_ -split ':\s*', 2)[1].Trim() } | Where-Object { $_ -match 'DialeDesk' } foreach ($target in $targets) { cmdkey /delete:$target | Out-Null; Done "removida: $target" } if (-not $targets) { Done 'nenhuma encontrada' } Write-Host '' Write-Host 'Pronto: o DialeDesk foi removido deste computador.' -ForegroundColor Green Write-Host 'Obs.: o registro da maquina na conta (dashboard) continua; remova por la se quiser.'