# ========================================================== # AZ-IS - Outil de diagnostic PC gratuit # Analyse les points cles du poste et copie un rapport lisible # dans le presse-papier, a coller directement dans le chat support. # ========================================================== Write-Host "AZ-IS - Diagnostic en cours, merci de patienter quelques secondes..." -ForegroundColor Cyan try { $os = Get-CimInstance Win32_OperatingSystem $cs = Get-CimInstance Win32_ComputerSystem $cpu = Get-CimInstance Win32_Processor $disks = Get-CimInstance Win32_LogicalDisk -Filter "DriveType=3" $ramTotalGB = [math]::Round($cs.TotalPhysicalMemory / 1GB, 1) $ramFreeGB = [math]::Round($os.FreePhysicalMemory / 1MB / 1024, 1) $ramUsedPct = [math]::Round((($ramTotalGB - $ramFreeGB) / $ramTotalGB) * 100, 0) $diskLines = foreach ($d in $disks) { $freeGB = [math]::Round($d.FreeSpace / 1GB, 1) $totalGB = [math]::Round($d.Size / 1GB, 1) $pctFree = if ($totalGB -gt 0) { [math]::Round(($freeGB / $totalGB) * 100, 0) } else { 0 } $alerte = if ($pctFree -lt 10) { " <== ESPACE CRITIQUE" } else { "" } " $($d.DeviceID) $freeGB Go libres sur $totalGB Go ($pctFree% libre)$alerte" } $pendingReboot = Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" $antivirus = "Non detecte" try { $av = Get-CimInstance -Namespace "root/SecurityCenter2" -ClassName AntivirusProduct -ErrorAction Stop if ($av) { $antivirus = ($av | Select-Object -ExpandProperty displayName) -join ", " } } catch {} $erreursRecentes = @() try { $erreursRecentes = Get-WinEvent -FilterHashtable @{LogName='System'; Level=2; StartTime=(Get-Date).AddDays(-2)} -MaxEvents 5 -ErrorAction Stop | ForEach-Object { " - [$($_.TimeCreated)] $($_.ProviderName): $($_.Message.Split("`n")[0])" } } catch {} $startupCount = (Get-CimInstance Win32_StartupCommand -ErrorAction SilentlyContinue | Measure-Object).Count $ramAlerte = if ($ramUsedPct -gt 85) { " <== RAM TRES CHARGEE" } else { "" } $cpuAlerte = if ($cpu.LoadPercentage -gt 80) { " <== CPU TRES CHARGE" } else { "" } $rapport = @" === RAPPORT DE DIAGNOSTIC AZ-IS === Genere le : $(Get-Date -Format "dd/MM/yyyy HH:mm") SYSTEME OS : $($os.Caption) ($($os.OSArchitecture)) Redemarrage en attente : $(if ($pendingReboot) { "OUI - a faire des que possible" } else { "Non" }) PROCESSEUR Modele : $($cpu.Name) Charge actuelle : $($cpu.LoadPercentage)%$cpuAlerte MEMOIRE (RAM) Totale : $ramTotalGB Go Utilisee : $ramUsedPct%$ramAlerte DISQUES $($diskLines -join "`n") ANTIVIRUS $antivirus PROGRAMMES AU DEMARRAGE $startupCount programme(s) au demarrage $(if ($startupCount -gt 15) { "<== BEAUCOUP, peut ralentir le demarrage" }) ERREURS SYSTEME RECENTES (48h) $(if ($erreursRecentes.Count -gt 0) { $erreursRecentes -join "`n" } else { " Aucune erreur critique recente" }) === FIN DU RAPPORT === "@ Write-Host $rapport -ForegroundColor White try { $rapport | Set-Clipboard Write-Host "" Write-Host "Rapport copie dans le presse-papier." -ForegroundColor Green Write-Host "Collez-le directement dans le chat de support AZ-IS (Ctrl+V)." -ForegroundColor Green } catch { Write-Host "" Write-Host "Copiez le rapport ci-dessus et collez-le dans le chat de support AZ-IS." -ForegroundColor Yellow } } catch { Write-Host "Une erreur est survenue pendant le diagnostic : $_" -ForegroundColor Red } Write-Host "" Write-Host "Appuyez sur une touche pour fermer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")