# Script de Diagnóstico do Cliente NoIdle - Windows # Execute este script no DESKTOP-BC16GDH como Administrador Write-Host "========================================" -ForegroundColor Cyan Write-Host "Diagnóstico do Cliente NoIdle" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" # 1. Verificar processos relacionados Write-Host "1. Verificando processos relacionados..." -ForegroundColor Yellow $processes = Get-Process | Where-Object { $_.ProcessName -like "*noidle*" -or $_.ProcessName -like "*pointcontrol*" -or $_.ProcessName -like "*idle*" -or $_.MainWindowTitle -like "*NoIdle*" -or $_.MainWindowTitle -like "*PointControl*" } if ($processes) { Write-Host " ✅ Processos encontrados:" -ForegroundColor Green $processes | ForEach-Object { Write-Host " - $($_.ProcessName) (PID: $($_.Id))" -ForegroundColor White } } else { Write-Host " ❌ Nenhum processo relacionado encontrado" -ForegroundColor Red } Write-Host "" # 2. Verificar serviços Windows Write-Host "2. Verificando serviços Windows..." -ForegroundColor Yellow $services = Get-Service | Where-Object { $_.DisplayName -like "*NoIdle*" -or $_.DisplayName -like "*PointControl*" -or $_.Name -like "*noidle*" -or $_.Name -like "*pointcontrol*" } if ($services) { Write-Host " ✅ Serviços encontrados:" -ForegroundColor Green $services | ForEach-Object { $status = if ($_.Status -eq "Running") { "🟢 Rodando" } else { "🔴 Parado" } Write-Host " - $($_.DisplayName) ($($_.Name)) - $status" -ForegroundColor White } } else { Write-Host " ❌ Nenhum serviço relacionado encontrado" -ForegroundColor Red } Write-Host "" # 3. Verificar conexões de rede para a API Write-Host "3. Verificando conexões de rede..." -ForegroundColor Yellow $connections = Get-NetTCPConnection | Where-Object { $_.RemoteAddress -like "*noidle*" -or $_.RemoteAddress -like "*pointcontrol*" -or ($_.RemotePort -eq 443 -and $_.State -eq "Established") } if ($connections) { Write-Host " ✅ Conexões ativas encontradas:" -ForegroundColor Green $connections | Select-Object -First 5 | ForEach-Object { $remoteAddr = try { [System.Net.Dns]::GetHostEntry($_.RemoteAddress).HostName } catch { $_.RemoteAddress } Write-Host " - $remoteAddr : $($_.RemotePort) ($($_.State))" -ForegroundColor White } } else { Write-Host " ⚠️ Nenhuma conexão ativa encontrada" -ForegroundColor Yellow } Write-Host "" # 4. Verificar arquivos de log Write-Host "4. Verificando arquivos de log..." -ForegroundColor Yellow $logPaths = @( "$env:ProgramFiles\NoIdle\logs", "$env:ProgramFiles\PointControl\logs", "$env:ProgramFiles(x86)\NoIdle\logs", "$env:ProgramFiles(x86)\PointControl\logs", "$env:APPDATA\NoIdle\logs", "$env:APPDATA\PointControl\logs", "$env:LOCALAPPDATA\NoIdle\logs", "$env:LOCALAPPDATA\PointControl\logs", "C:\NoIdle\logs", "C:\PointControl\logs" ) $foundLogs = $false foreach ($path in $logPaths) { if (Test-Path $path) { Write-Host " ✅ Logs encontrados em: $path" -ForegroundColor Green $logFiles = Get-ChildItem -Path $path -Filter "*.log" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 5 if ($logFiles) { foreach ($logFile in $logFiles) { Write-Host " - $($logFile.Name) (Última modificação: $($logFile.LastWriteTime))" -ForegroundColor White } } $foundLogs = $true } } if (-not $foundLogs) { Write-Host " ❌ Nenhum diretório de logs encontrado" -ForegroundColor Red } Write-Host "" # 5. Verificar arquivos de configuração Write-Host "5. Verificando arquivos de configuração..." -ForegroundColor Yellow $configPaths = @( "$env:ProgramFiles\NoIdle\config.json", "$env:ProgramFiles\PointControl\config.json", "$env:ProgramFiles(x86)\NoIdle\config.json", "$env:ProgramFiles(x86)\PointControl\config.json", "$env:APPDATA\NoIdle\config.json", "$env:APPDATA\PointControl\config.json", "$env:LOCALAPPDATA\NoIdle\config.json", "$env:LOCALAPPDATA\PointControl\config.json", "C:\NoIdle\config.json", "C:\PointControl\config.json" ) $foundConfig = $false foreach ($path in $configPaths) { if (Test-Path $path) { Write-Host " ✅ Configuração encontrada em: $path" -ForegroundColor Green try { $config = Get-Content $path | ConvertFrom-Json Write-Host " Conteúdo:" -ForegroundColor White $config | ConvertTo-Json | Write-Host -ForegroundColor Gray } catch { Write-Host " ⚠️ Erro ao ler configuração: $_" -ForegroundColor Yellow } $foundConfig = $true } } if (-not $foundConfig) { Write-Host " ❌ Nenhum arquivo de configuração encontrado" -ForegroundColor Red } Write-Host "" # 6. Testar conectividade com a API Write-Host "6. Testando conectividade com a API..." -ForegroundColor Yellow $apiUrl = "https://admin.noidle.tech" try { $response = Invoke-WebRequest -Uri "$apiUrl/api/devices/heartbeat" -Method POST -Body '{"device_id":"DEV-1762999424206-0BJR2Q"}' -ContentType "application/json" -TimeoutSec 10 -ErrorAction Stop Write-Host " ✅ API acessível (Status: $($response.StatusCode))" -ForegroundColor Green } catch { Write-Host " ❌ Erro ao acessar API: $_" -ForegroundColor Red Write-Host " Verifique se há firewall ou proxy bloqueando" -ForegroundColor Yellow } Write-Host "" # 7. Verificar firewall Write-Host "7. Verificando regras de firewall..." -ForegroundColor Yellow $firewallRules = Get-NetFirewallRule | Where-Object { $_.DisplayName -like "*NoIdle*" -or $_.DisplayName -like "*PointControl*" } if ($firewallRules) { Write-Host " ✅ Regras de firewall encontradas:" -ForegroundColor Green $firewallRules | ForEach-Object { Write-Host " - $($_.DisplayName) (Enabled: $($_.Enabled))" -ForegroundColor White } } else { Write-Host " ⚠️ Nenhuma regra de firewall específica encontrada" -ForegroundColor Yellow } Write-Host "" # 8. Verificar variáveis de ambiente Write-Host "8. Verificando variáveis de ambiente..." -ForegroundColor Yellow $envVars = Get-ChildItem Env: | Where-Object { $_.Name -like "*NOIDLE*" -or $_.Name -like "*POINTCONTROL*" -or $_.Name -like "*IDLE*" } if ($envVars) { Write-Host " ✅ Variáveis de ambiente encontradas:" -ForegroundColor Green $envVars | ForEach-Object { Write-Host " - $($_.Name) = $($_.Value)" -ForegroundColor White } } else { Write-Host " ⚠️ Nenhuma variável de ambiente relacionada encontrada" -ForegroundColor Yellow } Write-Host "" Write-Host "========================================" -ForegroundColor Cyan Write-Host "Diagnóstico concluído!" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" Write-Host "Device ID esperado: DEV-1762999424206-0BJR2Q" -ForegroundColor Yellow Write-Host "API URL: https://admin.noidle.tech" -ForegroundColor Yellow Write-Host ""