Pastebin
Retrouvez, créez et partagez vos snippets en temps réel.
Rechercher un Pastebin
Aucun paste trouvé.
Créer un paste
Pastebin
Blog
Cl
# ---------------------------------------------------------- # Nettoyage complet des traces résiduelles des logiciels # À exécuter en tant qu'administrateur # ---------------------------------------------------------- Write-Host "⚠️ Nettoyage des traces résiduelles en cours. Vérifiez chaque étape !" -ForegroundColor Yellow # 1️⃣ Supprimer fichiers temporaires Windows et utilisateur Write-Host "Suppression fichiers temporaires..." $TempPaths = @("$env:TEMP", "$env:WINDIR\Temp", "$env:LOCALAPPDATA\Temp") foreach ($path in $TempPaths) { if (Test-Path $path) { Get-ChildItem -Path $path -Recurse -Force -ErrorAction SilentlyContinue | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue } } # 2️⃣ Supprimer caches et fichiers résiduels d'applications Write-Host "Suppression caches d'applications..." $AppPaths = @( "$env:LOCALAPPDATA\Programs", "$env:LOCALAPPDATA\Packages", "$env:APPDATA", "$env:PROGRAMDATA" ) foreach ($path in $AppPaths) { if (Test-Path $path) { Get-ChildItem -Path $path -Recurse -Force -ErrorAction SilentlyContinue | Where-Object { $_.PSIsContainer -and ($_.Name -match "Java|Oracle|Python|Node|VSCode|JetBrains|Gradle|Maven") } | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue } } # 3️⃣ Nettoyage du PATH et variables inutilisées Write-Host "Nettoyage des variables d'environnement PATH et JAVA_HOME" [Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Machine") $oldPath = [Environment]::GetEnvironmentVariable("Path", "Machine") $newPath = ($oldPath -split ";" | Where-Object { $_ -notmatch "Java|Python|Node|Gradle|Maven" }) -join ";" [Environment]::SetEnvironmentVariable("Path", $newPath, "Machine") # 4️⃣ Nettoyer les clés de registre des logiciels désinstallés Write-Host "Nettoyage clés registre résiduelles..." $RegPaths = @( "HKCU:\Software", "HKLM:\SOFTWARE", "HKLM:\SOFTWARE\WOW6432Node" ) foreach ($reg in $RegPaths) { Get-ChildItem -Path $reg -ErrorAction SilentlyContinue | Where-Object { $_.Name -match "JavaSoft|Oracle|Python|Node|JetBrains|VSCode|Gradle|Maven" } | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue } # 5️⃣ Nettoyer le cache des navigateurs principaux Write-Host "Suppression du cache des navigateurs..." $BrowserCache = @( "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Cache", "$env:LOCALAPPDATA\Mozilla\Firefox\Profiles\*.default\cache2", "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\Cache" ) foreach ($cache in $BrowserCache) { if (Test-Path $cache) { Get-ChildItem -Path $cache -Recurse -Force -ErrorAction SilentlyContinue | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue } } # 6️⃣ Nettoyer les logs Windows Write-Host "Suppression logs Windows..." wevtutil el | ForEach-Object { wevtutil cl $_ } # 7️⃣ Nettoyage disque automatique Write-Host "Lancement du nettoyage de disque..." Start-Process cleanmgr.exe -ArgumentList "/sagerun:1" Write-Host "✅ Nettoyage des logiciels résiduels terminé. Redémarrez votre PC pour appliquer tous les changements." -ForegroundColor Green
Créé il y a 2 mois.