# ============================================================================ # TEST-SIMPLE.PS1 # Script de test minimal pour diagnostiquer les problemes # ============================================================================ # Creer le log IMMEDIATEMENT $LogFile = "$env:TEMP\WTurn-Test-Simple-$(Get-Date -Format 'yyyyMMdd-HHmmss').log" function Write-Log { param([string]$Message) $Entry = "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] $Message" Add-Content -Path $LogFile -Value $Entry Write-Host $Entry } try { Write-Log "===== DEBUT TEST SIMPLE =====" Write-Log "Computer: $env:COMPUTERNAME" Write-Log "User: $env:USERNAME" Write-Log "PowerShell: $($PSVersionTable.PSVersion)" Write-Log "Fichier log: $LogFile" Write-Host "`n========================================" -ForegroundColor Cyan Write-Host "TEST SIMPLE - DIAGNOSTIC" -ForegroundColor Cyan Write-Host "========================================`n" -ForegroundColor Cyan # Test 1: Droits admin Write-Log "Test 1: Verification droits admin" $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) Write-Log "Admin: $isAdmin" Write-Host "OK Droits admin: $isAdmin" -ForegroundColor $(if($isAdmin){"Green"}else{"Red"}) # Test 2: Version OS Write-Log "Test 2: Version OS" $OS = Get-WmiObject -Class Win32_OperatingSystem Write-Log "OS: $($OS.Caption)" Write-Host "OK OS: $($OS.Caption)" -ForegroundColor Green # Test 3: Ping DC Write-Log "Test 3: Ping vers DC (192.168.100.250)" $ping = Test-Connection -ComputerName 192.168.100.250 -Count 2 -Quiet Write-Log "Ping DC: $ping" Write-Host "OK Ping DC: $ping" -ForegroundColor $(if($ping){"Green"}else{"Red"}) # Test 4: Resolution DNS Write-Log "Test 4: Resolution DNS base.w-turn.lan" try { $dns = Resolve-DnsName -Name "base.w-turn.lan" -ErrorAction Stop Write-Log "DNS resolu: $($dns.IPAddress)" Write-Host "OK DNS: $($dns.IPAddress)" -ForegroundColor Green } catch { Write-Log "DNS ERREUR: $($_.Exception.Message)" Write-Host "ERR DNS: Echec" -ForegroundColor Red } # Test 5: Port 445 (SMB/AD) Write-Log "Test 5: Test port 445 (AD)" $port = Test-NetConnection -ComputerName 192.168.100.250 -Port 445 -WarningAction SilentlyContinue Write-Log "Port 445: $($port.TcpTestSucceeded)" Write-Host "OK Port 445: $($port.TcpTestSucceeded)" -ForegroundColor $(if($port.TcpTestSucceeded){"Green"}else{"Red"}) Write-Log "===== FIN TEST - SUCCES =====" Write-Host "`n========================================" -ForegroundColor Green Write-Host "TEST TERMINE AVEC SUCCES" -ForegroundColor Green Write-Host "========================================" -ForegroundColor Green Write-Host "`nFichier log cree:" -ForegroundColor Yellow Write-Host $LogFile -ForegroundColor Cyan Write-Host "`nEnvoyez ce fichier via:" -ForegroundColor Yellow Write-Host "https://super.boarder.w-turn.org/utilities/diagnostic.html" -ForegroundColor Cyan } catch { Write-Log "ERREUR CRITIQUE: $($_.Exception.Message)" Write-Log "Ligne: $($_.InvocationInfo.ScriptLineNumber)" Write-Log "Stack: $($_.ScriptStackTrace)" Write-Host "`n========================================" -ForegroundColor Red Write-Host "ERREUR CRITIQUE" -ForegroundColor Red Write-Host "========================================" -ForegroundColor Red Write-Host $_.Exception.Message -ForegroundColor Red Write-Host "`nFichier log:" -ForegroundColor Yellow Write-Host $LogFile -ForegroundColor Cyan } Write-Host "`n" Read-Host "Appuyez sur Entree pour quitter"