diff --git a/.github/scripts/validate_bat.py b/.github/scripts/validate_bat.py index 3143067..e51a189 100644 --- a/.github/scripts/validate_bat.py +++ b/.github/scripts/validate_bat.py @@ -54,10 +54,11 @@ def parse_table_section(content, heading_fragment): # Services conditionnels : présents dans prerequis mais exclus du test mandatory # car dépendent des variables NEED_* du script, ou en conflit documenté CONDITIONAL_SERVICES = { - "BthAvctpSvc", # conditionnel NEED_BT - "TermService", # conditionnel NEED_RDP - "SessionEnv", # conditionnel NEED_RDP - "uhssvc", # protégé WU (CLAUDE.md) mais listé dans prerequis comme à désactiver + "BthAvctpSvc", # conditionnel NEED_BT + "TermService", # conditionnel NEED_RDP + "SessionEnv", # conditionnel NEED_RDP + "UmRdpService", # conditionnel NEED_RDP (RDP User Mode Port Redirector — v5) + "uhssvc", # protégé WU (CLAUDE.md) mais listé dans prerequis comme à désactiver } # Motifs de tâches WU/WaaSMedic/UpdateOrchestrator — jamais désactivées (règle WU) @@ -142,6 +143,39 @@ def get_active_lines(content): ("powercfg /h off", r"\bpowercfg\b.*?/h\s+off"), ("Prefetch desactive", r"EnablePrefetcher.*?/d\s+0"), ("SysMain desactive", r"Services\\SysMain.*?/d\s+4"), + # ── Ajouts v2 ───────────────────────────────────────────────────────────── + ("EnableEventTranscript=0 (telemetry DB locale)", + r"EnableEventTranscript.*?/d\s+0"), + ("DontReportInfectionInformation=1 (MRT cloud)", + r"DontReportInfectionInformation.*?/d\s+1"), + ("DisableTailoredExperiencesWithDiagnosticData=1 (HKLM)", + r"HKLM.*DisableTailoredExperiencesWithDiagnosticData.*?/d\s+1"), + ("DisableWindowsSpotlightOnActionCenter=1", + r"DisableWindowsSpotlightOnActionCenter.*?/d\s+1"), + ("DisableWindowsSpotlightOnSettings=1", + r"DisableWindowsSpotlightOnSettings.*?/d\s+1"), + ("DisableTailoredExperiencesWithDiagnosticData=1 (HKCU)", + r"HKCU.*DisableTailoredExperiencesWithDiagnosticData.*?/d\s+1"), + ("DisableBandwidthThrottling=1 (LanmanWorkstation)", + r"LanmanWorkstation.*DisableBandwidthThrottling.*?/d\s+1"), + # ── Ajouts v3 ───────────────────────────────────────────────────────────── + ("EnableDesktopAnalyticsProcessing=0 (traitement telemetrie local)", + r"EnableDesktopAnalyticsProcessing.*?/d\s+0"), + ("ShowSyncProviderNotifications=0 (pubs OneDrive dans Explorateur)", + r"ShowSyncProviderNotifications.*?/d\s+0"), + ("PreventDeviceMetadataFromNetwork=1 (telechargement metadonnees)", + r"PreventDeviceMetadataFromNetwork.*?/d\s+1"), + ("KeepAliveTime=300000 (TCP keep-alive 5 min)", + r"KeepAliveTime.*?/d\s+300000"), + ("KeepAliveInterval=1000 (retransmission TCP 1s)", + r"KeepAliveInterval.*?/d\s+1000"), + # ── Ajouts v4 ───────────────────────────────────────────────────────────── + ("SwapfileControl=0 (swapfile.sys UWP desactive, ~256 Mo liberes)", + r"SwapfileControl.*?/d\s+0"), + ("AutoLogger RadioMgr desactive (journal radio manager)", + r"Autologger\\RadioMgr.*?/d\s+0"), + ("AutoLogger RdrLog desactive (journal redirecteur SMB)", + r"Autologger\\RdrLog.*?/d\s+0"), ] @@ -355,6 +389,8 @@ def test_section10_empty(content): def test_powershell_noninteractive(active_lines): errors = [] for lineno, line in active_lines: + if re.search(r"^\s*echo\b", line, re.IGNORECASE): + continue if not re.search(r"(?:^|&&|\()\s*powershell\b", line.strip(), re.IGNORECASE): continue if not re.search(r"-NonInteractive\b|-noni\b", line, re.IGNORECASE): @@ -574,6 +610,246 @@ def run_test(name, errors): return True + +# ── Nouvelles listes v2 (services/hosts) ───────────────────────────────────── +# Ces éléments ont été ajoutés dans win11-setup.bat v2 pour réduire l'empreinte +# mémoire sur les systèmes 1 Go RAM. +NEW_MANDATORY_SERVICES_V2 = [ + "WinRM", # Windows Remote Management — PS remoting inutile + "RasAuto", # Remote Access Auto Connection Manager + "RasMan", # Remote Access Connection Manager + "iphlpsvc", # IP Helper — tunnels IPv6 inutiles en IPv4 pur + "IKEEXT", # IKE/AuthIP IPsec Key Management + "PolicyAgent", # IPsec Policy Agent + "fhsvc", # File History Service + "AxInstSV", # ActiveX Installer Service + "MSiSCSI", # iSCSI Initiator + "TextInputManagementService", # Saisie tactile / stylet + "GraphicsPerfSvc", # Diagnostics performance GPU (telemetrie) +] + +NEW_MANDATORY_HOSTS_V2 = [ + "eu.vortex-win.data.microsoft.com", # Pipeline Vortex EU + "us.vortex-win.data.microsoft.com", # Pipeline Vortex US + "inference.microsoft.com", # Copilot / AI inference cloud 25H2 +] + +# ── Nouvelles listes v3 (services/hosts/apps) ──────────────────────────────── +NEW_MANDATORY_SERVICES_V3 = [ + "NcdAutoSetup", # Network Connected Devices Auto-Setup — scan LAN inutile sur PC fixe + "lmhosts", # TCP/IP NetBIOS Helper — résolution LMHOSTS inutile sur réseau IP moderne + "CertPropSvc", # Certificate Propagation — sync certs smart card (SCardSvr déjà désactivé) +] + +NEW_MANDATORY_HOSTS_V3 = [ + "arc.msn.com", # Application Reliability Center — télémétrie + "redir.metaservices.microsoft.com", # Redirecteur metaservices Microsoft + "i1.services.social.microsoft.com", # Analytics social Microsoft +] + +NEW_MANDATORY_APPS_V3 = [ + "Microsoft.MicrosoftJournal", # Application Journal (stylet/encre) — 25H2 +] + + +def _check_services_disabled(content, services): + """Vérifie que les services sont désactivés (Start=4 ou sc stop).""" + errors = [] + loop_services = set() + for m in re.finditer(r"for\s+%%S\s+in\s+\(([^)]+)\)", content, re.IGNORECASE): + for s in m.group(1).split(): + loop_services.add(s.strip().lower()) + for svc in services: + in_reg = bool(re.search( + r"\\Services\\" + re.escape(svc) + r'(\\|"|\s)' + r".*?/d\s+4", + content, re.IGNORECASE + )) + in_loop = svc.lower() in loop_services + if not in_reg and not in_loop: + errors.append(f" Service absent : '{svc}' (ni Start=4 ni sc stop)") + return errors + + +def _check_hosts_blocked(content, domains): + """Vérifie que les domaines sont bloqués dans la section hosts (section 16).""" + errors = [] + hosts_section = "" + in_s16 = False + for line in content.splitlines(): + if "SECTION 16" in line: + in_s16 = True + if in_s16 and "SECTION 17" in line: + break + if in_s16: + hosts_section += line + "\n" + if not hosts_section: + return [" Section 16 (hosts) introuvable"] + hosts_lower = hosts_section.lower() + for domain in domains: + if domain.lower() not in hosts_lower: + errors.append(f" Domaine absent des hosts : \'{domain}\'") + return errors + + +def test_new_services_v2_disabled(content): + return _check_services_disabled(content, NEW_MANDATORY_SERVICES_V2) + + +def test_new_hosts_v2_blocked(content): + return _check_hosts_blocked(content, NEW_MANDATORY_HOSTS_V2) + + +def test_new_services_v3_disabled(content): + return _check_services_disabled(content, NEW_MANDATORY_SERVICES_V3) + + +def test_new_hosts_v3_blocked(content): + return _check_hosts_blocked(content, NEW_MANDATORY_HOSTS_V3) + + +def test_new_apps_v3_in_applist(content): + """Vérifie que les nouvelles apps v3 sont dans APPLIST.""" + errors = [] + m = re.search(r'set\s+"APPLIST=([^"]+)"', content, re.IGNORECASE) + if not m: + return [" Variable APPLIST introuvable"] + applist = m.group(1).lower() + for app in NEW_MANDATORY_APPS_V3: + if app.lower() not in applist: + errors.append(f" App v3 absente de APPLIST : \'{app}\'") + return errors + + +# ── Nouvelles listes v4 (services/hosts/tâches) ────────────────────────────── +# Ces éléments ont été ajoutés dans win11-setup.bat v4 pour alléger encore +# la mémoire et réduire les communications télémétrie sur systèmes 1 Go RAM. +NEW_MANDATORY_SERVICES_V4 = [ + "AppReadiness", # App Readiness Service — inutile post-setup + "WorkFoldersSvc", # Work Folders Sync — entreprise uniquement + "RmSvc", # Radio Management — interface Mode Avion UI seulement + "SgrmBroker", # System Guard Runtime Monitor — rapport sécurité vers MS + "NPSMSvc", # Now Playing Session Manager — media Xbox (apps supprimées) + "AssignedAccessManagerSvc", # Mode kiosque — inutile sur PC perso + "autotimesvc", # Auto Time Zone cellulaire — inutile sur PC fixe sans SIM +] + +NEW_MANDATORY_HOSTS_V4 = [ + "dmd.metaservices.microsoft.com", # Métadonnées appareil — télémétrie + "tsfe.trafficshaping.microsoft.com", # Traffic shaping / télémétrie réseau + "rad.msn.com", # MSN publicités + "b.rad.msn.com", # MSN publicités (CDN) + "ads.msn.com", # MSN publicités + "ads1.msads.net", # Réseau publicitaire Microsoft + "adnxs.com", # AppNexus — réseau pub utilisé par Microsoft Ads +] + +NEW_MANDATORY_TASKS_V4 = [ + r"\Microsoft\Windows\Input\LocalUserSyncDataAvailable", + r"\Microsoft\Windows\Input\MouseSyncDataAvailable", + r"\Microsoft\Windows\Input\PenSyncDataAvailable", + r"\Microsoft\Windows\Input\TouchpadSyncDataAvailable", + r"\Microsoft\Windows\LiveKernelReports\AgentWatcher", + r"\Microsoft\Windows\HelloFace\FODCleanupTask", + r"\Microsoft\Windows\Sysmain\HybridDriveCachePrepopulate", + r"\Microsoft\Windows\Sysmain\HybridDriveCacheRebalance", + r"\Microsoft\Windows\Sysmain\ResPriStaticDbSync", + r"\Microsoft\Windows\Sysmain\WsSwapAssessmentTask", + r"\Microsoft\Windows\SpacePort\SpaceAgentTask", + r"\Microsoft\Windows\BrokerInfrastructure\BrokerInfrastructureTask", + r"\Microsoft\Windows\CloudContent\UnifiedAssetFramework", + r"\Microsoft\Windows\WlanSvc\CDSSync", +] + + +def test_new_services_v4_disabled(content): + return _check_services_disabled(content, NEW_MANDATORY_SERVICES_V4) + + +def test_new_hosts_v4_blocked(content): + return _check_hosts_blocked(content, NEW_MANDATORY_HOSTS_V4) + + +def test_new_tasks_v4_disabled(content): + """Vérifie que les nouvelles tâches v4 sont désactivées (schtasks /Change /Disable).""" + errors = [] + content_lower = content.lower() + for task in NEW_MANDATORY_TASKS_V4: + if task.lower() not in content_lower: + errors.append(f" Tâche v4 absente du script : '{task}'") + return errors + + +# ── Nouvelles listes v5 (services/hosts/tâches) ────────────────────────────── +# Ces éléments ont été ajoutés dans win11-setup.bat v5 pour réduire encore +# l'empreinte mémoire sur les systèmes 1 Go RAM. +NEW_MANDATORY_SERVICES_V5 = [ + "NetSetupSvc", # Network Setup Service — inutile post-setup (déclenché à la demande seulement) + "RpcLocator", # RPC Locator — service déprécié depuis Vista, inutile sur réseau moderne + # UmRdpService est conditionnel NEED_RDP — ajouté dans CONDITIONAL_SERVICES +] + +NEW_MANDATORY_HOSTS_V5 = [ + "pipe.aria.microsoft.com", # Pipeline ARIA principal (hors Edge-spécifique) + "mobile.pipe.aria.microsoft.com", # Pipeline ARIA mobile +] + +NEW_MANDATORY_TASKS_V5 = [ + r"\Microsoft\Windows\Application Experience\SdbinstMergeDbTask", + r"\Microsoft\Windows\CertificateServicesClient\AutoEnrollmentTask", + r"\Microsoft\Windows\CertificateServicesClient\UserTask", + r"\Microsoft\Windows\SettingSync\NetworkStateChangeTask", + r"\Microsoft\Windows\Maps\UsersOptInToMapsUpdatesTask", +] + + +def test_new_services_v5_disabled(content): + return _check_services_disabled(content, NEW_MANDATORY_SERVICES_V5) + + +def test_new_hosts_v5_blocked(content): + return _check_hosts_blocked(content, NEW_MANDATORY_HOSTS_V5) + + +def test_new_tasks_v5_disabled(content): + """Vérifie que les nouvelles tâches v5 sont désactivées (schtasks /Change /Disable).""" + errors = [] + content_lower = content.lower() + for task in NEW_MANDATORY_TASKS_V5: + if task.lower() not in content_lower: + errors.append(f" Tâche v5 absente du script : '{task}'") + return errors + + +def write_github_summary(tests_results, passed, failed): + """Écrit un rapport markdown dans $GITHUB_STEP_SUMMARY si disponible.""" + import os + summary_file = os.environ.get("GITHUB_STEP_SUMMARY") + if not summary_file: + return + total = passed + failed + with open(summary_file, "a", encoding="utf-8") as f: + if failed == 0: + f.write(f"# ✅ Validation réussie — {passed}/{total} tests passés\n\n") + f.write("> Super ! Le script Windows est conforme à toutes les règles.\n\n") + else: + f.write(f"# ❌ {failed} erreur(s) — {passed}/{total} tests passés\n\n") + f.write("> Des problèmes ont été trouvés dans le script.\n\n") + f.write("## 📋 Résultats\n\n") + f.write("| # | Résultat | Test |\n") + f.write("|---|----------|------|\n") + for i, (name, errors) in enumerate(tests_results, 1): + icon = "✅" if not errors else "❌" + f.write(f"| {i} | {icon} | {name} |\n") + if failed > 0: + f.write("\n## 🔍 Détail des erreurs\n\n") + for name, errors in tests_results: + if errors: + f.write(f"### ❌ {name}\n\n") + f.write("```\n") + f.write("\n".join(errors)) + f.write("\n```\n\n") + + def main(): if not SCRIPT_PATH.exists(): print(f"[{FAIL_MARK}] Fichier introuvable : {SCRIPT_PATH}") @@ -666,16 +942,47 @@ def main(): test_panther_deletion(active_lines)), ("32 schtasks jamais dans une boucle for", test_no_schtasks_in_for_loop(content)), + # ── Tests v2 — services et hosts ajoutés ────────────────────────────── + ("33 Services v2 desactives (WinRM RasAuto/Man iphlpsvc IKEEXT PolicyAgent etc.)", + test_new_services_v2_disabled(content)), + ("34 Domaines telemetrie v2 bloques (eu/us.vortex-win inference.microsoft.com)", + test_new_hosts_v2_blocked(content)), + # ── Tests v3 — services, hosts et apps ajoutés ──────────────────────── + ("35 Services v3 desactives (NcdAutoSetup lmhosts CertPropSvc)", + test_new_services_v3_disabled(content)), + ("36 Domaines telemetrie v3 bloques (arc.msn.com redir.metaservices i1.services.social)", + test_new_hosts_v3_blocked(content)), + ("37 Apps v3 presentes dans APPLIST (Microsoft.MicrosoftJournal)", + test_new_apps_v3_in_applist(content)), + # ── Tests v4 — services, hosts et tâches ajoutés ───────────────────── + ("38 Services v4 desactives (AppReadiness WorkFoldersSvc RmSvc SgrmBroker NPSMSvc etc.)", + test_new_services_v4_disabled(content)), + ("39 Domaines telemetrie v4 bloques (dmd.metaservices tsfe rad.msn ads.msn adnxs.com etc.)", + test_new_hosts_v4_blocked(content)), + ("40 Taches planifiees v4 desactivees (Input Sysmain LiveKernelReports HelloFace etc.)", + test_new_tasks_v4_disabled(content)), + # ── Tests v5 — services, hosts et tâches ajoutés ───────────────────── + ("41 Services v5 desactives (NetSetupSvc RpcLocator)", + test_new_services_v5_disabled(content)), + ("42 Domaines telemetrie v5 bloques (pipe.aria mobile.pipe.aria)", + test_new_hosts_v5_blocked(content)), + ("43 Taches planifiees v5 desactivees (SdbinstMergeDb AutoEnrollment CertUser SettingSync Maps)", + test_new_tasks_v5_disabled(content)), ] passed = 0 failed = 0 + results = [] for name, errors in tests: - if run_test(name, errors): + ok = run_test(name, errors) + results.append((name, errors)) + if ok: passed += 1 else: failed += 1 + write_github_summary(results, passed, failed) + print("=" * 65) if failed == 0: print(f"OK : {passed}/{passed + failed} tests passes") diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index fe7abb9..394e024 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,4 +1,4 @@ -name: Validate win11-setup.bat +name: 🛡️ Validation win11-setup.bat on: push: @@ -9,17 +9,27 @@ on: jobs: validate: - name: Static validation + name: "🔍 43 vérifications automatiques" runs-on: ubuntu-latest steps: - - name: Checkout + - name: "📥 Récupération du code" uses: actions/checkout@v4 - - name: Set up Python + - name: "🐍 Préparation Python" uses: actions/setup-python@v5 with: python-version: "3.x" - - name: Run static validation - run: python .github/scripts/validate_bat.py + - name: "🧪 Validation statique (43 tests)" + run: | + echo "## 🚀 Démarrage de la validation..." >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "| Info | Valeur |" >> $GITHUB_STEP_SUMMARY + echo "|------|--------|" >> $GITHUB_STEP_SUMMARY + echo "| 📄 Script | \`win11-setup.bat\` |" >> $GITHUB_STEP_SUMMARY + echo "| 📏 Taille | $(wc -l < win11-setup.bat) lignes |" >> $GITHUB_STEP_SUMMARY + echo "| 📋 Règles | \`prerequis_WIN11.md\` |" >> $GITHUB_STEP_SUMMARY + echo "| 🤖 Validateur | \`.github/scripts/validate_bat.py\` |" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + python .github/scripts/validate_bat.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3bbe7b6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__/ +*.pyc +*.pyo diff --git a/CLAUDE.md b/CLAUDE.md index 173d8c7..28e7b74 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -34,22 +34,22 @@ Il n'existe pas d'`autounattend.xml` dans ce dépôt (fichier séparé, hors dé | 2 | Point de restauration — **toujours en premier** | | 3 | Suppression fichiers Panther (mot de passe en clair 25H2) | | 4 | Pagefile fixe 6 Go — vérification 10 Go libres avant | -| 5 | Mémoire : compression, SysMain/Prefetch désactivés | -| 6 | Télémétrie / Copilot / Recall / IA 25H2 | -| 7 | AutoLoggers (DiagTrack, DiagLog, SQMLogger, WiFiSession, CloudExperienceHostOobe, NtfsLog, ReadyBoot, AppModel, LwtNetLog) | +| 5 | Mémoire : compression, SysMain/Prefetch désactivés, `SwapfileControl=0` (swapfile.sys UWP ~256 Mo) | +| 6 | Télémétrie / Copilot / Recall / IA 25H2 / EventTranscript / MRT / TailoredExperiences / DesktopAnalytics | +| 7 | AutoLoggers (DiagTrack, DiagLog, SQMLogger, WiFiSession, CloudExperienceHostOobe, NtfsLog, ReadyBoot, AppModel, LwtNetLog, RadioMgr, RdrLog) | | 8 | Windows Search — désactive web/Bing/Search Highlights (WSearch reste actif) | | 9 | GameDVR, Delivery Optimization, Edge démarrage anticipé/arrière-plan (HKCU) | | 10 | Politiques Windows Update | | 11 | Vie privée, sécurité, WER, ContentDelivery, AppPrivacy | -| 11b | CDP, Clipboard (Win+V local activé, cloud désactivé), ContentDeliveryManager, HKCU privacy, Ink Workspace, Peernet, TCP sécurité, LLMNR, WPAD, SMBv1, Biométrie | +| 11b | CDP, Clipboard (Win+V local activé, cloud désactivé), ContentDeliveryManager, HKCU privacy, Spotlight suggestions (ActionCenter/Settings/TailoredExperiences HKCU), ShowSyncProviderNotifications=0, PreventDeviceMetadataFromNetwork=1, Ink Workspace, Peernet, TCP sécurité, LLMNR, WPAD, SMBv1, Biométrie | | 12 | Interface Win10 (taskbar, widgets, menu contextuel, hibernation) | -| 13 | CPU : `SystemResponsiveness=10`, PowerThrottling off, sécurité TCP/IP (`DisableIPSourceRouting`, `EnableICMPRedirect=0`) | +| 13 | CPU : `SystemResponsiveness=10`, PowerThrottling off, sécurité TCP/IP (`DisableIPSourceRouting`, `EnableICMPRedirect=0`), `DisableBandwidthThrottling=1` (LanmanWorkstation), TCP Keep-Alive (`KeepAliveTime=300000`, `KeepAliveInterval=1000`) | | 13b | Config avancée : bypass TPM/RAM, PasswordLess, NumLock, Snap Assist, menu alimentation, RDP conditionnel | -| 14 | Services → `Start=4` (90+ services, effectif après reboot) | -| 15 | `sc stop` immédiat + `sc failure DiagTrack` | -| 16 | Fichier `hosts` — blocage 57+ domaines télémétrie | +| 14 | Services → `Start=4` (113+ services, effectif après reboot) dont WinRM, RasAuto, RasMan, iphlpsvc, IKEEXT, PolicyAgent, fhsvc, AxInstSV, MSiSCSI, TextInputManagementService, GraphicsPerfSvc, NcdAutoSetup, lmhosts, CertPropSvc, AppReadiness, WorkFoldersSvc, RmSvc, SgrmBroker, NPSMSvc, AssignedAccessManagerSvc, autotimesvc, NetSetupSvc, RpcLocator, UmRdpService (conditionnel NEED_RDP=0) | +| 15 | `sc stop` immédiat (incluant les 24 nouveaux services v2+v3+v4+v5) + `sc failure DiagTrack` | +| 16 | Fichier `hosts` — blocage 72+ domaines télémétrie dont `eu/us.vortex-win.data.microsoft.com`, `inference.microsoft.com`, `arc.msn.com`, `redir.metaservices.microsoft.com`, `dmd.metaservices.microsoft.com`, `tsfe.trafficshaping.microsoft.com`, `rad.msn.com`, `ads.msn.com`, `adnxs.com`, `pipe.aria.microsoft.com`, `mobile.pipe.aria.microsoft.com` | | 17a | GPO AppCompat (`DisableUAR`, `DisableInventory`, `DisablePCA`) | -| 17 | 73+ tâches planifiées désactivées (`schtasks /Change /Disable`) | +| 17 | 93+ tâches planifiées désactivées (`schtasks /Change /Disable`) | | 18 | Suppression apps UWP (PowerShell `Remove-AppxPackage`) | | 19 | Vidage `C:\Windows\Prefetch\` | | 19b | Vérification intégrité système (SFC/DISM) + restart Explorer | @@ -65,6 +65,15 @@ set NEED_PRINTER=1 # 0 = désactiver Spooler (pas d'imprimante) set BLOCK_ADOBE=0 # 1 = activer le bloc Adobe dans hosts ``` +## CI / Validation automatique + +| Fichier | Rôle | +|---|---| +| `.github/workflows/validate.yml` | Déclenche `validate_bat.py` sur push/PR vers `Update` et `main` | +| `.github/scripts/validate_bat.py` | 43 tests statiques — règles lues depuis `prerequis_WIN11.md` + checks hardcodés + rapport GitHub Step Summary | + +Tests clés : valeurs registre interdites, services protégés, apps protégées, WU intouché, hosts WU jamais bloqués, structure 20 sections, optimisations obligatoires, services v2/v3/v4/v5 désactivés, hosts v2/v3/v4/v5 bloqués, apps v3 présentes, tâches v4/v5 désactivées. + ## Conventions de code - Chaque section se termine par une ligne `echo [%date% %time%] Section N : ... >> "%LOG%"` @@ -72,3 +81,36 @@ set BLOCK_ADOBE=0 # 1 = activer le bloc Adobe dans hosts - Les services conditionnels utilisent `if "%NEED_X%"=="0" reg add ...` - Les tâches planifiées avec espaces dans le chemin → appels `schtasks` individuels (pas de boucle `for`) - Les clés HKCU s'appliquent à l'utilisateur courant (contexte FirstLogonCommands = premier utilisateur) + +## Règles opérationnelles — Git et validation + +Ces règles sont issues de problèmes concrets rencontrés lors de modifications sur ce dépôt. Elles sont **obligatoires**. + +### 1. Toujours pousser les fichiers volumineux via `git` directement + +Les outils MCP (`create_or_update_file`) ne peuvent pas gérer fiablement des fichiers de 90 Ko+ avec des caractères Unicode. Le contenu est tronqué ou corrompu silencieusement. + +**Règle** : pour `win11-setup.bat`, `validate_bat.py` et tout fichier > 10 Ko, utiliser exclusivement : +```bash +git add +git commit -m "message" +git push -u origin +``` +Ne jamais passer le contenu d'un grand fichier en paramètre inline d'un outil MCP ou d'un agent. +Ne jamais mentionner Claude (claude.ai/code) dans le "message" de commit + +### 2. Ne jamais lancer d'agents en arrière-plan sur les mêmes fichiers + +Un agent lancé en arrière-plan (`run_in_background`) peut lire un état stale du dépôt (avant un commit récent) et pousser une version corrompue ou périmée du fichier, écrasant les corrections. + +**Règle** : toute opération qui lit, modifie ou pousse `win11-setup.bat` ou `validate_bat.py` doit être effectuée **séquentiellement dans la session principale**. Aucun agent parallèle ou arrière-plan pour ces fichiers. + +### 3. Exécuter le validateur avant tout premier push + +Une clé registre interdite (ex. `DisableWindowsSpotlightFeatures`) qui passe inaperçue en local fait échouer la CI. Corriger en CI = commits supplémentaires inutiles. + +**Règle** : avant le premier `git push` de toute modification de `win11-setup.bat`, toujours exécuter : +```bash +python3 .github/scripts/validate_bat.py +``` +et vérifier que tous les tests passent (0 FAIL). Ne pousser qu'après validation locale réussie. diff --git a/README.md b/README.md index e8fc462..e3eb873 100644 --- a/README.md +++ b/README.md @@ -37,23 +37,23 @@ Le script est organisé en **20 sections** qui s'exécutent séquentiellement : | 2 | Création d'un point de restauration système (obligatoire avant toute modification) | | 3 | Suppression des fichiers Panther (`C:\Windows\Panther`) — sécurité : mot de passe admin en clair (25H2) | | 4 | Pagefile fixe à 6 Go sur C: (uniquement si ≥ 10 Go d'espace libre) | -| 5 | Optimisation mémoire : compression activée, Prefetch désactivé, SysMain arrêté, opt-out télémétrie PowerShell | -| 6 | Zéro télémétrie : 20+ clés registre — Copilot, Recall, DiagTrack, IA 25H2, Spotlight, Cloud Search, collecte Microsoft | -| 7 | AutoLoggers désactivés : DiagTrack, DiagLog, SQMLogger, WiFiSession, NtfsLog, ReadyBoot, AppModel, LwtNetLog, CloudExperienceHostOobe | +| 5 | Optimisation mémoire : compression activée, Prefetch désactivé, SysMain arrêté, opt-out télémétrie PowerShell, `SwapfileControl=0` (swapfile.sys UWP désactivé, ~256 Mo libérés) | +| 6 | Zéro télémétrie : 25+ clés registre — Copilot, Recall, DiagTrack, IA 25H2, Spotlight, Cloud Search, EventTranscript, MRT, TailoredExperiences, DesktopAnalytics | +| 7 | AutoLoggers désactivés : DiagTrack, DiagLog, SQMLogger, WiFiSession, NtfsLog, ReadyBoot, AppModel, LwtNetLog, CloudExperienceHostOobe, RadioMgr, RdrLog | | 8 | Windows Search : désactivation recherche web, Bing, Search Highlights animés (WSearch reste actif) | | 9 | GameDVR désactivé, Delivery Optimization désactivé, Edge démarrage anticipé/arrière-plan off (HKCU) | | 10 | Politiques Windows Update : redémarrage rapide, réseau mesuré autorisé, notifications conservées | | 11 | Vie privée & sécurité : Cortana, ID publicitaire, historique d'activité, géolocalisation, RemoteAssistance, saisie, AutoPlay, contenu cloud, cartes hors ligne, modèle vocal | -| 11b | CDP, Presse-papiers local Win+V activé (cloud/cross-device désactivé), ContentDeliveryManager, HKCU privacy, LLMNR, WPAD, SMBv1, Biométrie | +| 11b | CDP, Presse-papiers local Win+V activé (cloud/cross-device désactivé), ContentDeliveryManager, HKCU privacy, Spotlight suggestions (ActionCenter/Settings), notifications sync provider (OneDrive/tiers), métadonnées matériel réseau, LLMNR, WPAD, SMBv1, Biométrie | | 12 | Interface Win10 : barre à gauche (HKLM), widgets supprimés, Teams/Copilot masqués, menu contextuel classique, "Ce PC" par défaut, Galerie/Réseau masqués, son démarrage off, hibernation off, Fast Startup off — centre de notifications conservé | -| 13 | Priorité CPU : `SystemResponsiveness = 10`, PowerThrottling off, TCP security | +| 13 | Priorité CPU : `SystemResponsiveness = 10`, PowerThrottling off, TCP security, `DisableBandwidthThrottling=1`, TCP Keep-Alive 5 min | | 13b | Config système avancée : bypass TPM/RAM, PasswordLess, NumLock, Snap Assist, menu alimentation, RDP conditionnel | -| 14 | 90+ services désactivés via registre (`Start=4`) | -| 15 | Arrêt immédiat des services désactivés + `sc failure DiagTrack` | -| 16 | Fichier `hosts` : 57+ domaines de télémétrie bloqués en `0.0.0.0` (+ bloc Adobe optionnel) | +| 14 | 113+ services désactivés via registre (`Start=4`) dont WinRM, RasAuto, RasMan, iphlpsvc, IKEEXT, PolicyAgent, fhsvc, AxInstSV, MSiSCSI, TextInputManagementService, GraphicsPerfSvc, **NcdAutoSetup**, **lmhosts**, **CertPropSvc**, AppReadiness, WorkFoldersSvc, RmSvc, SgrmBroker, NPSMSvc, AssignedAccessManagerSvc, autotimesvc, **NetSetupSvc**, **RpcLocator**, **UmRdpService** (conditionnel NEED_RDP=0) | +| 15 | Arrêt immédiat des services désactivés (incluant les 24 nouveaux v2+v3+v4+v5) + `sc failure DiagTrack` | +| 16 | Fichier `hosts` : 72+ domaines de télémétrie bloqués en `0.0.0.0` dont `eu/us.vortex-win.data.microsoft.com`, `inference.microsoft.com`, `arc.msn.com`, `redir.metaservices.microsoft.com`, `dmd.metaservices.microsoft.com`, `tsfe.trafficshaping.microsoft.com`, `rad.msn.com`, `ads.msn.com`, `adnxs.com`, **`pipe.aria.microsoft.com`**, **`mobile.pipe.aria.microsoft.com`** (+ bloc Adobe optionnel) | | 17a | GPO AppCompat : `DisableUAR`, `DisableInventory`, `DisablePCA`, `AITEnable=0` | -| 17 | 73+ tâches planifiées désactivées (télémétrie, CEIP, Recall, Copilot, Xbox, IA 25H2, MDM, Work Folders) | -| 18 | Suppression de 73 applications bloatware (UWP) via PowerShell | +| 17 | 93+ tâches planifiées désactivées (télémétrie, CEIP, Recall, Copilot, Xbox, IA 25H2, MDM, Work Folders, Input sync, LiveKernelReports, HelloFace, Sysmain, SpacePort, BrokerInfrastructure, CloudContent, WlanSvc/CDSSync, **SdbinstMergeDbTask**, **AutoEnrollmentTask**, **UserTask**, **NetworkStateChangeTask**, **UsersOptInToMapsUpdatesTask**) | +| 18 | Suppression de 74 applications bloatware (UWP) via PowerShell (dont Microsoft.MicrosoftJournal) | | 19 | Nettoyage du dossier `C:\Windows\Prefetch` | | 19b | Vérification intégrité système (SFC/DISM) + restart Explorer | | 20 | Résumé d'exécution dans le log + fin du script | @@ -145,11 +145,11 @@ Sur un Windows 11 déjà installé : | Catégorie | Quantité | |---|---| -| Clés registre modifiées | 135+ | -| Services désactivés | 90+ | -| Tâches planifiées désactivées | 73+ | -| Applications (UWP) supprimées | 73+ | -| Domaines de télémétrie bloqués | 57+ | +| Clés registre modifiées | 160+ | +| Services désactivés | 113+ | +| Tâches planifiées désactivées | 93+ | +| Applications (UWP) supprimées | 74+ | +| Domaines de télémétrie bloqués | 72+ | | Options de configuration | 5 | --- @@ -158,7 +158,7 @@ Sur un Windows 11 déjà installé : | Fichier | Description | |---|---| -| `win11-setup.bat` | Script principal d'optimisation post-installation (~997 lignes) | +| `win11-setup.bat` | Script principal d'optimisation post-installation (~1135 lignes) | | `prerequis_WIN11.md` | Document de spécification : règles de conception, listes d'apps/services/tâches, contraintes techniques | | `CLAUDE.md` | Fichier de configuration interne — structure du script, règles absolues, conventions | @@ -168,7 +168,7 @@ Sur un Windows 11 déjà installé : ### Pourquoi pas de boucle pour les clés registre ? -Les 135+ appels `reg add` sont écrits individuellement et non factorisés dans une boucle `for`. Ce choix est délibéré : +Les 150+ appels `reg add` sont écrits individuellement et non factorisés dans une boucle `for`. Ce choix est délibéré : - **Chemins et types hétérogènes** — chaque clé a sa propre ruche (`HKLM`, `HKCU`), son propre chemin, son type (`REG_DWORD`, `REG_SZ`, `REG_MULTI_SZ`) et sa valeur. Une boucle nécessiterait un tableau de paramètres plus complexe à maintenir que les appels directs. - **Lisibilité et auditabilité** — un script de sécurité/optimisation doit pouvoir être relu ligne par ligne. Chaque `reg add` est explicite : on voit immédiatement ce qui est modifié, où et avec quelle valeur. diff --git a/prerequis_WIN11.md b/prerequis_WIN11.md index bb5706c..cb9d9cc 100644 --- a/prerequis_WIN11.md +++ b/prerequis_WIN11.md @@ -230,6 +230,9 @@ Ces services ne doivent **jamais** être désactivés : | `TapiSrv` | Telephony (TAPI) — inutile sur PC de bureau sans modem/RNIS/softphone | | `WFDSConMgrSvc` | Wi-Fi Direct Services Connection Manager — inutile sur PC de bureau fixe | | `SessionEnv` | Remote Desktop Configuration — conditionnel `NEED_RDP=0` (complément TermService) | +| `NetSetupSvc` | Network Setup Service — ne tourne qu'à la configuration réseau initiale, inutile post-setup | +| `RpcLocator` | Remote Procedure Call Locator — service déprécié depuis Vista, inutile sur réseau moderne | +| `UmRdpService` | RDP User Mode Port Redirector — conditionnel `NEED_RDP=0` (inutile si RDP désactivé) | > ⚠️ `WSearch` : **NE PAS ajouter à cette liste** — toujours conservé sans exception @@ -310,6 +313,11 @@ Ces services ne doivent **jamais** être désactivés : | `\Microsoft\Windows\DUSM\dusmtask` | Maintenance Data Usage Service — complément DusmSvc désactivé | | `\Microsoft\Windows\Management\Provisioning\Cellular` | Approvisionnement réseau cellulaire — inutile sur PC de bureau | | `\Microsoft\Windows\Management\Provisioning\Logon` | MDM provisioning au logon — inutile hors Intune/SCCM | +| `\Microsoft\Windows\Application Experience\SdbinstMergeDbTask` | Fusion base compatibilité applicative/télémétrie — v5 | +| `\Microsoft\Windows\CertificateServicesClient\AutoEnrollmentTask` | Inscription auto certificats Active Directory — inutile hors entreprise — v5 | +| `\Microsoft\Windows\CertificateServicesClient\UserTask` | Tâche utilisateur inscription certificats — inutile hors entreprise — v5 | +| `\Microsoft\Windows\SettingSync\NetworkStateChangeTask` | Synchronisation paramètres déclenchée sur changement réseau — v5 | +| `\Microsoft\Windows\Maps\UsersOptInToMapsUpdatesTask` | Opt-in mises à jour cartographiques (MapsBroker déjà désactivé) — v5 | --- @@ -351,6 +359,8 @@ Ces services ne doivent **jamais** être désactivés : | `outlookads.live.com` | Publicités Outlook | | `fp.msedge.net` | CDN télémétrie Edge | | `nexus.officeapps.live.com` | Télémétrie Office | +| `pipe.aria.microsoft.com` | Pipeline ARIA principal (hors Edge-spécifique) — v5 | +| `mobile.pipe.aria.microsoft.com` | Pipeline ARIA mobile — v5 | > Adobe (commenté par défaut — activer si pas de logiciel Adobe) : > `lmlicenses.wip4.adobe.com`, `lm.licenses.adobe.com`, `practivate.adobe.com`, `activate.adobe.com` diff --git a/win11-setup.bat b/win11-setup.bat index ff54dfa..b335218 100644 --- a/win11-setup.bat +++ b/win11-setup.bat @@ -45,10 +45,10 @@ echo [%date% %time%] Section 3 : Fichiers Panther supprimes >> "%LOG%" :: ═══════════════════════════════════════════════════════════ :: SECTION 4 — Vérification espace disque + Pagefile fixe 6 Go :: Méthode registre native — wmic pagefileset/Set-WmiInstance INTERDITS (pas de token WMI write en FirstLogonCommands) -:: wmic logicaldisk (lecture seule) utilisé en détection d'espace — silencieux si absent (fallback ligne 59) +:: PowerShell (Get-PSDrive) utilisé en détection d'espace — wmic.exe supprimé de Windows 11 25H2 :: ═══════════════════════════════════════════════════════════ set FREE= -for /f "tokens=2 delims==" %%F in ('wmic logicaldisk where DeviceID^="C:" get FreeSpace /value 2^>nul') do set FREE=%%F +for /f "tokens=*" %%F in ('powershell -NoProfile -NonInteractive -Command "[long](Get-PSDrive C).Free" 2^>nul') do set FREE=%%F if defined FREE ( set /a FREE_GB=!FREE:~0,-6! / 1000 if !FREE_GB! GEQ 10 ( @@ -59,7 +59,7 @@ if defined FREE ( echo [%date% %time%] Section 4 : Pagefile auto conserve - espace insuffisant (!FREE_GB! Go) >> "%LOG%" ) ) else ( - echo [%date% %time%] Section 4 : Pagefile auto conserve - FREE non defini (wmic echoue) >> "%LOG%" + echo [%date% %time%] Section 4 : Pagefile auto conserve - FREE non defini (PowerShell echoue) >> "%LOG%" ) :: ═══════════════════════════════════════════════════════════ @@ -99,6 +99,8 @@ reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled / reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v NtfsDisableLastAccessUpdate /t REG_DWORD /d 1 /f >nul 2>&1 :: NTFS — désactiver les noms courts 8.3 (réduit les entrées NTFS par fichier) reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v NtfsDisable8dot3NameCreation /t REG_DWORD /d 1 /f >nul 2>&1 +:: Swapfile.sys — désactiver le fichier swap UWP (apps Store supprimées — économie disque ~256 Mo + réduction I/O) +reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v SwapfileControl /t REG_DWORD /d 0 /f >nul 2>&1 echo [%date% %time%] Section 5 : Memoire/Prefetch/SysMain/NTFS OK >> "%LOG%" :: ═══════════════════════════════════════════════════════════ @@ -170,7 +172,15 @@ reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ :: Recherche cloud désactivée reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v AllowCloudSearch /t REG_DWORD /d 0 /f >nul 2>&1 :: OneDrive — policy non écrite (conservé, démarrage géré par l'utilisateur) +:: Event Transcript — désactiver la base de données locale des événements télémétrie (réduit I/O disque) +reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack\EventTranscriptKey" /v EnableEventTranscript /t REG_DWORD /d 0 /f >nul 2>&1 +:: MRT — ne pas remonter les résultats d'analyse d'infection au cloud Microsoft +reg add "HKLM\SOFTWARE\Policies\Microsoft\MRT" /v DontReportInfectionInformation /t REG_DWORD /d 1 /f >nul 2>&1 +:: Tailored Experiences — désactiver les recommandations personnalisées basées sur les données de diagnostic (HKLM) +reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v DisableTailoredExperiencesWithDiagnosticData /t REG_DWORD /d 1 /f >nul 2>&1 +:: Desktop Analytics — désactiver le traitement des données analytiques locales +reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v EnableDesktopAnalyticsProcessing /t REG_DWORD /d 0 /f >nul 2>&1 echo [%date% %time%] Section 6 : Telemetrie/AI/Copilot/Recall/SIUF/CEIP/Defender/DataCollection OK >> "%LOG%" :: ═══════════════════════════════════════════════════════════ @@ -190,6 +200,9 @@ reg add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\ReadyBoot" /v Star reg add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AppModel" /v Start /t REG_DWORD /d 0 /f >nul 2>&1 :: LwtNetLog — trace réseau légère (inutile en production) reg add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\LwtNetLog" /v Start /t REG_DWORD /d 0 /f >nul 2>&1 +:: AutoLoggers Radio / Réseau supplémentaires (v4) +reg add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\RadioMgr" /v Start /t REG_DWORD /d 0 /f >nul 2>&1 +reg add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\RdrLog" /v Start /t REG_DWORD /d 0 /f >nul 2>&1 echo [%date% %time%] Section 7 : AutoLoggers desactives >> "%LOG%" :: ═══════════════════════════════════════════════════════════ @@ -433,7 +446,16 @@ reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" /v EnableMultica reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp" /v DisableWpad /t REG_DWORD /d 1 /f >nul 2>&1 :: SMBv1 — désactiver explicitement côté serveur (sécurité, déjà off sur 25H2 — belt-and-suspenders) reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v SMB1 /t REG_DWORD /d 0 /f >nul 2>&1 +:: Windows Spotlight — désactiver suggestions cloud sur Action Center et Paramètres (HKCU) +:: Note: DisableWindowsSpotlightFeatures interdit (prerequis_WIN11.md — Spotlight conservé) +reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v DisableWindowsSpotlightOnActionCenter /t REG_DWORD /d 1 /f >nul 2>&1 +reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v DisableWindowsSpotlightOnSettings /t REG_DWORD /d 1 /f >nul 2>&1 +reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v DisableTailoredExperiencesWithDiagnosticData /t REG_DWORD /d 1 /f >nul 2>&1 +:: Notifications sync provider — désactiver les pubs OneDrive/tiers dans l'Explorateur +reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSyncProviderNotifications /t REG_DWORD /d 0 /f >nul 2>&1 +:: Métadonnées matériel — empêcher le téléchargement de pilotes/infos depuis Internet +reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Device Metadata" /v PreventDeviceMetadataFromNetwork /t REG_DWORD /d 1 /f >nul 2>&1 echo [%date% %time%] Section 11b : CDP/Clipboard/NCSI/CDM/AppPrivacy/LockScreen/Handwriting/Maintenance/Geo/PrivacyHKCU/Tips/EventLog/InkWorkspace/Peernet/LLMNR/SMBv1/WPAD OK >> "%LOG%" :: ═══════════════════════════════════════════════════════════ @@ -580,7 +602,12 @@ reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v TcpTimedWai reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v DisableIPSourceRouting /t REG_DWORD /d 2 /f >nul 2>&1 :: TCP/IP sécurité — désactiver les redirections ICMP (prévient les attaques de redirection de routage) reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v EnableICMPRedirect /t REG_DWORD /d 0 /f >nul 2>&1 -echo [%date% %time%] Section 13 : PriorityControl/PowerThrottling/TCP/IPSecurity OK >> "%LOG%" +:: Réseau — désactiver le throttling LanmanWorkstation (transferts fichiers plus rapides sur réseau local) +reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v DisableBandwidthThrottling /t REG_DWORD /d 1 /f >nul 2>&1 +:: TCP Keep-Alive — réduire de 2h à 5 minutes (libère connexions inactives plus tôt) +reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v KeepAliveTime /t REG_DWORD /d 300000 /f >nul 2>&1 +reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v KeepAliveInterval /t REG_DWORD /d 1000 /f >nul 2>&1 +echo [%date% %time%] Section 13 : PriorityControl/PowerThrottling/TCP/IPSecurity/LanmanWorkstation OK >> "%LOG%" :: ═══════════════════════════════════════════════════════════ :: SECTION 13b — Configuration système avancée @@ -720,6 +747,54 @@ reg add "HKLM\SYSTEM\CurrentControlSet\Services\TapiSrv" /v Start /t REG_DWORD / reg add "HKLM\SYSTEM\CurrentControlSet\Services\WFDSConMgrSvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 :: Remote Desktop Configuration — conditionnel (complément TermService NEED_RDP=0) if "%NEED_RDP%"=="0" reg add "HKLM\SYSTEM\CurrentControlSet\Services\SessionEnv" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: Services réseau étendus inutiles sur PC de bureau domestique +reg add "HKLM\SYSTEM\CurrentControlSet\Services\WinRM" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +reg add "HKLM\SYSTEM\CurrentControlSet\Services\RasAuto" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +reg add "HKLM\SYSTEM\CurrentControlSet\Services\RasMan" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: IP Helper — tunnels IPv6 (6to4/Teredo/ISATAP) inutiles en IPv4 pur +reg add "HKLM\SYSTEM\CurrentControlSet\Services\iphlpsvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: IPsec Key Management — inutile sans VPN ou politiques IPsec +reg add "HKLM\SYSTEM\CurrentControlSet\Services\IKEEXT" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: IPsec Policy Agent — inutile sans politiques IPsec ou Active Directory +reg add "HKLM\SYSTEM\CurrentControlSet\Services\PolicyAgent" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: Historique des fichiers — aucune sauvegarde demandée (complément SDRSVC) +reg add "HKLM\SYSTEM\CurrentControlSet\Services\fhsvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: ActiveX Installer — inutile sans déploiement ActiveX/OCX +reg add "HKLM\SYSTEM\CurrentControlSet\Services\AxInstSV" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: iSCSI Initiator — inutile sans stockage réseau SAN/iSCSI +reg add "HKLM\SYSTEM\CurrentControlSet\Services\MSiSCSI" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: Saisie tactile / stylet — inutile sur PC de bureau sans écran tactile +reg add "HKLM\SYSTEM\CurrentControlSet\Services\TextInputManagementService" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: Diagnostics performance GPU — collecte telemetrie graphique inutile +reg add "HKLM\SYSTEM\CurrentControlSet\Services\GraphicsPerfSvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: NcdAutoSetup — détecte/installe auto les périphériques réseau — inutile sur PC fixe +reg add "HKLM\SYSTEM\CurrentControlSet\Services\NcdAutoSetup" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: lmhosts — TCP/IP NetBIOS Helper — résolution noms via LMHOSTS, inutile sur réseau IP moderne +reg add "HKLM\SYSTEM\CurrentControlSet\Services\lmhosts" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: CertPropSvc — Certificate Propagation — sync certs smart card, inutile (SCardSvr désactivé) +reg add "HKLM\SYSTEM\CurrentControlSet\Services\CertPropSvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: Services — allègement mémoire supplémentaire (v4) +:: AppReadiness — App Readiness Service — prépare apps au 1er login, inutile post-setup +reg add "HKLM\SYSTEM\CurrentControlSet\Services\AppReadiness" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: WorkFoldersSvc — Work Folders Sync — entreprise uniquement, inutile sur PC perso +reg add "HKLM\SYSTEM\CurrentControlSet\Services\WorkFoldersSvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: RmSvc — Radio Management — interface bouton Mode Avion uniquement, sans contrôle RF réel +reg add "HKLM\SYSTEM\CurrentControlSet\Services\RmSvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: SgrmBroker — System Guard Runtime Monitor Broker — surveillance sécurité avec rapport vers MS +reg add "HKLM\SYSTEM\CurrentControlSet\Services\SgrmBroker" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: NPSMSvc — Now Playing Session Manager — APIs media Xbox/Groove (apps supprimées) +reg add "HKLM\SYSTEM\CurrentControlSet\Services\NPSMSvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: AssignedAccessManagerSvc — Mode kiosque — inutile sur PC perso +reg add "HKLM\SYSTEM\CurrentControlSet\Services\AssignedAccessManagerSvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: autotimesvc — Auto Time Zone via réseau cellulaire — inutile sur PC fixe sans SIM +reg add "HKLM\SYSTEM\CurrentControlSet\Services\autotimesvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: Services — allègement v5 +:: NetSetupSvc — Network Setup Service — ne tourne qu'à la configuration réseau initiale, inutile post-setup +reg add "HKLM\SYSTEM\CurrentControlSet\Services\NetSetupSvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: RpcLocator — Remote Procedure Call Locator — service déprécié depuis Vista, inutile sur réseau moderne +reg add "HKLM\SYSTEM\CurrentControlSet\Services\RpcLocator" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 +:: UmRdpService — RDP User Mode Port Redirector — inutile si RDP désactivé (conditionnel NEED_RDP) +if "%NEED_RDP%"=="0" reg add "HKLM\SYSTEM\CurrentControlSet\Services\UmRdpService" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 echo [%date% %time%] Section 14 : Services Start=4 ecrits (effectifs apres reboot) >> "%LOG%" :: ═══════════════════════════════════════════════════════════ @@ -740,6 +815,23 @@ for %%S in (PcaSvc stisvc TapiSrv WFDSConMgrSvc) do ( sc query %%S >nul 2>&1 && sc stop %%S >nul 2>&1 ) if "%NEED_RDP%"=="0" sc stop SessionEnv >nul 2>&1 +:: Arrêt immédiat des nouveaux services réseau désactivés +for %%S in (WinRM RasAuto RasMan iphlpsvc IKEEXT PolicyAgent fhsvc AxInstSV MSiSCSI TextInputManagementService GraphicsPerfSvc) do ( + sc query %%S >nul 2>&1 && sc stop %%S >nul 2>&1 +) +:: Arrêt immédiat des nouveaux services périphériques/réseau désactivés +for %%S in (NcdAutoSetup lmhosts CertPropSvc) do ( + sc query %%S >nul 2>&1 && sc stop %%S >nul 2>&1 +) +:: Arrêt immédiat des nouveaux services v4 +for %%S in (AppReadiness WorkFoldersSvc RmSvc SgrmBroker NPSMSvc AssignedAccessManagerSvc autotimesvc) do ( + sc query %%S >nul 2>&1 && sc stop %%S >nul 2>&1 +) +:: Arrêt immédiat des nouveaux services v5 +for %%S in (NetSetupSvc RpcLocator) do ( + sc query %%S >nul 2>&1 && sc stop %%S >nul 2>&1 +) +if "%NEED_RDP%"=="0" sc stop UmRdpService >nul 2>&1 echo [%date% %time%] Section 15 : sc stop envoye aux services listes >> "%LOG%" :: Paramètres de récupération DiagTrack — Ne rien faire sur toutes défaillances sc failure DiagTrack reset= 0 actions= none/0/none/0/none/0 >nul 2>&1 @@ -806,6 +898,21 @@ findstr /C:"Telemetry blocks - win11-setup" "%HOSTSFILE%" >nul 2>&1 || ( echo 0.0.0.0 outlookads.live.com echo 0.0.0.0 fp.msedge.net echo 0.0.0.0 nexus.officeapps.live.com + echo 0.0.0.0 eu.vortex-win.data.microsoft.com + echo 0.0.0.0 us.vortex-win.data.microsoft.com + echo 0.0.0.0 inference.microsoft.com + echo 0.0.0.0 arc.msn.com + echo 0.0.0.0 redir.metaservices.microsoft.com + echo 0.0.0.0 i1.services.social.microsoft.com + echo 0.0.0.0 dmd.metaservices.microsoft.com + echo 0.0.0.0 tsfe.trafficshaping.microsoft.com + echo 0.0.0.0 rad.msn.com + echo 0.0.0.0 b.rad.msn.com + echo 0.0.0.0 ads.msn.com + echo 0.0.0.0 ads1.msads.net + echo 0.0.0.0 adnxs.com + echo 0.0.0.0 pipe.aria.microsoft.com + echo 0.0.0.0 mobile.pipe.aria.microsoft.com ) >> "%HOSTSFILE%" 2>nul if "%BLOCK_ADOBE%"=="1" ( ( @@ -941,6 +1048,37 @@ schtasks /Query /TN "\Microsoft\Windows\DUSM\dusmtask" >nul 2>&1 && schtasks /Ch schtasks /Query /TN "\Microsoft\Windows\Management\Provisioning\Cellular" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Management\Provisioning\Cellular" /Disable >nul 2>&1 :: MDM Provisioning Logon — enrôlement MDM au logon (inutile hors Intune/SCCM) schtasks /Query /TN "\Microsoft\Windows\Management\Provisioning\Logon" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Management\Provisioning\Logon" /Disable >nul 2>&1 +:: Tâches saisie / données dispositifs — envoi données périphériques à Microsoft (v4) +schtasks /Query /TN "\Microsoft\Windows\Input\LocalUserSyncDataAvailable" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Input\LocalUserSyncDataAvailable" /Disable >nul 2>&1 +schtasks /Query /TN "\Microsoft\Windows\Input\MouseSyncDataAvailable" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Input\MouseSyncDataAvailable" /Disable >nul 2>&1 +schtasks /Query /TN "\Microsoft\Windows\Input\PenSyncDataAvailable" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Input\PenSyncDataAvailable" /Disable >nul 2>&1 +schtasks /Query /TN "\Microsoft\Windows\Input\TouchpadSyncDataAvailable" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Input\TouchpadSyncDataAvailable" /Disable >nul 2>&1 +:: Rapport kernel — collecte données crash envoyées à MS (v4) +schtasks /Query /TN "\Microsoft\Windows\LiveKernelReports\AgentWatcher" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\LiveKernelReports\AgentWatcher" /Disable >nul 2>&1 +:: Windows Hello Face — nettoyage FOD biométrie désactivée (v4) +schtasks /Query /TN "\Microsoft\Windows\HelloFace\FODCleanupTask" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\HelloFace\FODCleanupTask" /Disable >nul 2>&1 +:: SysMain Hybrid Drive — tâches résiduelles complément SysMain désactivé (v4) +schtasks /Query /TN "\Microsoft\Windows\Sysmain\HybridDriveCachePrepopulate" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Sysmain\HybridDriveCachePrepopulate" /Disable >nul 2>&1 +schtasks /Query /TN "\Microsoft\Windows\Sysmain\HybridDriveCacheRebalance" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Sysmain\HybridDriveCacheRebalance" /Disable >nul 2>&1 +schtasks /Query /TN "\Microsoft\Windows\Sysmain\ResPriStaticDbSync" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Sysmain\ResPriStaticDbSync" /Disable >nul 2>&1 +schtasks /Query /TN "\Microsoft\Windows\Sysmain\WsSwapAssessmentTask" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Sysmain\WsSwapAssessmentTask" /Disable >nul 2>&1 +:: SpacePort — agent Storage Spaces (inutile sur PC mono-disque) (v4) +schtasks /Query /TN "\Microsoft\Windows\SpacePort\SpaceAgentTask" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\SpacePort\SpaceAgentTask" /Disable >nul 2>&1 +:: Infrastructure tâches arrière-plan — planification UWP (apps supprimées) (v4) +schtasks /Query /TN "\Microsoft\Windows\BrokerInfrastructure\BrokerInfrastructureTask" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\BrokerInfrastructure\BrokerInfrastructureTask" /Disable >nul 2>&1 +:: CloudContent — livraison contenu publicitaire cloud (v4) +schtasks /Query /TN "\Microsoft\Windows\CloudContent\UnifiedAssetFramework" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\CloudContent\UnifiedAssetFramework" /Disable >nul 2>&1 +:: WiFi Sense — synchronisation appareils connectés via WiFi Direct (v4) +schtasks /Query /TN "\Microsoft\Windows\WlanSvc\CDSSync" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\WlanSvc\CDSSync" /Disable >nul 2>&1 +:: Application Experience — fusion base compatibilité applicative/télémétrie (v5) +schtasks /Query /TN "\Microsoft\Windows\Application Experience\SdbinstMergeDbTask" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Application Experience\SdbinstMergeDbTask" /Disable >nul 2>&1 +:: CertificateServicesClient — inscription auto certs Active Directory — inutile hors entreprise (v5) +schtasks /Query /TN "\Microsoft\Windows\CertificateServicesClient\AutoEnrollmentTask" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\CertificateServicesClient\AutoEnrollmentTask" /Disable >nul 2>&1 +schtasks /Query /TN "\Microsoft\Windows\CertificateServicesClient\UserTask" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\CertificateServicesClient\UserTask" /Disable >nul 2>&1 +:: SettingSync — synchronisation paramètres déclenchée sur changement réseau (complément BackgroundUploadTask) (v5) +schtasks /Query /TN "\Microsoft\Windows\SettingSync\NetworkStateChangeTask" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\SettingSync\NetworkStateChangeTask" /Disable >nul 2>&1 +:: Maps — opt-in mises à jour cartographiques (MapsBroker déjà désactivé) (v5) +schtasks /Query /TN "\Microsoft\Windows\Maps\UsersOptInToMapsUpdatesTask" >nul 2>&1 && schtasks /Change /TN "\Microsoft\Windows\Maps\UsersOptInToMapsUpdatesTask" /Disable >nul 2>&1 echo [%date% %time%] Section 17 : Taches planifiees desactivees >> "%LOG%" :: ═══════════════════════════════════════════════════════════ @@ -949,7 +1087,7 @@ echo [%date% %time%] Section 17 : Taches planifiees desactivees >> "%LOG%" :: Note : NEED_RDP et NEED_WEBCAM n'affectent plus la suppression des apps (incluses inconditionnellement) :: ═══════════════════════════════════════════════════════════ -set "APPLIST=7EE7776C.LinkedInforWindows_3.0.42.0_x64__w1wdnht996qgy Facebook.Facebook MSTeams Microsoft.3DBuilder Microsoft.3DViewer Microsoft.549981C3F5F10 Microsoft.Advertising.Xaml Microsoft.BingNews Microsoft.BingWeather Microsoft.GetHelp Microsoft.Getstarted Microsoft.Messaging Microsoft.Microsoft3DViewer Microsoft.MicrosoftOfficeHub Microsoft.MicrosoftSolitaireCollection Microsoft.MixedReality.Portal Microsoft.NetworkSpeedTest Microsoft.News Microsoft.Office.OneNote Microsoft.Office.Sway Microsoft.OneConnect Microsoft.People Microsoft.Print3D Microsoft.RemoteDesktop Microsoft.SkypeApp Microsoft.Todos Microsoft.Wallet Microsoft.Whiteboard Microsoft.WindowsAlarms Microsoft.WindowsFeedbackHub Microsoft.WindowsMaps Microsoft.WindowsSoundRecorder Microsoft.XboxApp Microsoft.XboxGameOverlay Microsoft.XboxGamingOverlay Microsoft.XboxIdentityProvider Microsoft.XboxSpeechToTextOverlay Microsoft.ZuneMusic Microsoft.ZuneVideo Netflix SpotifyAB.SpotifyMusic king.com.* clipchamp.Clipchamp Microsoft.Copilot Microsoft.BingSearch Microsoft.Windows.DevHome Microsoft.PowerAutomateDesktop Microsoft.WindowsCamera 9WZDNCRFJ4Q7 Microsoft.OutlookForWindows MicrosoftCorporationII.QuickAssist Microsoft.MicrosoftStickyNotes Microsoft.BioEnrollment Microsoft.GamingApp Microsoft.WidgetsPlatformRuntime Microsoft.Windows.NarratorQuickStart Microsoft.Windows.ParentalControls Microsoft.Windows.SecureAssessmentBrowser Microsoft.WindowsCalculator MicrosoftWindows.CrossDevice Microsoft.LinkedIn Microsoft.Teams Microsoft.Xbox.TCUI MicrosoftCorporationII.MicrosoftFamily MicrosoftCorporationII.PhoneLink Microsoft.YourPhone Microsoft.Windows.Ai.Copilot.Provider Microsoft.WindowsRecall Microsoft.RecallApp MicrosoftWindows.Client.WebExperience Microsoft.GamingServices Microsoft.WindowsCommunicationsApps Microsoft.Windows.HolographicFirstRun" +set "APPLIST=7EE7776C.LinkedInforWindows_3.0.42.0_x64__w1wdnht996qgy Facebook.Facebook MSTeams Microsoft.3DBuilder Microsoft.3DViewer Microsoft.549981C3F5F10 Microsoft.Advertising.Xaml Microsoft.BingNews Microsoft.BingWeather Microsoft.GetHelp Microsoft.Getstarted Microsoft.Messaging Microsoft.Microsoft3DViewer Microsoft.MicrosoftOfficeHub Microsoft.MicrosoftSolitaireCollection Microsoft.MixedReality.Portal Microsoft.NetworkSpeedTest Microsoft.News Microsoft.Office.OneNote Microsoft.Office.Sway Microsoft.OneConnect Microsoft.People Microsoft.Print3D Microsoft.RemoteDesktop Microsoft.SkypeApp Microsoft.Todos Microsoft.Wallet Microsoft.Whiteboard Microsoft.WindowsAlarms Microsoft.WindowsFeedbackHub Microsoft.WindowsMaps Microsoft.WindowsSoundRecorder Microsoft.XboxApp Microsoft.XboxGameOverlay Microsoft.XboxGamingOverlay Microsoft.XboxIdentityProvider Microsoft.XboxSpeechToTextOverlay Microsoft.ZuneMusic Microsoft.ZuneVideo Netflix SpotifyAB.SpotifyMusic king.com.* clipchamp.Clipchamp Microsoft.Copilot Microsoft.BingSearch Microsoft.Windows.DevHome Microsoft.PowerAutomateDesktop Microsoft.WindowsCamera 9WZDNCRFJ4Q7 Microsoft.OutlookForWindows MicrosoftCorporationII.QuickAssist Microsoft.MicrosoftStickyNotes Microsoft.BioEnrollment Microsoft.GamingApp Microsoft.WidgetsPlatformRuntime Microsoft.Windows.NarratorQuickStart Microsoft.Windows.ParentalControls Microsoft.Windows.SecureAssessmentBrowser Microsoft.WindowsCalculator MicrosoftWindows.CrossDevice Microsoft.LinkedIn Microsoft.Teams Microsoft.Xbox.TCUI MicrosoftCorporationII.MicrosoftFamily MicrosoftCorporationII.PhoneLink Microsoft.YourPhone Microsoft.Windows.Ai.Copilot.Provider Microsoft.WindowsRecall Microsoft.RecallApp MicrosoftWindows.Client.WebExperience Microsoft.GamingServices Microsoft.WindowsCommunicationsApps Microsoft.Windows.HolographicFirstRun Microsoft.MicrosoftJournal" for %%A in (%APPLIST%) do ( powershell -NonInteractive -NoProfile -Command "Get-AppxPackage -AllUsers -Name %%A | Remove-AppxPackage -ErrorAction SilentlyContinue" >nul 2>&1 powershell -NonInteractive -NoProfile -Command "Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -eq '%%A' } | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue" >nul 2>&1 @@ -985,13 +1123,13 @@ echo [%date% %time%] Section 19b : Explorer redémarre >> "%LOG%" :: SECTION 20 — Fin :: ═══════════════════════════════════════════════════════════ echo [%date% %time%] === RESUME === >> "%LOG%" -echo [%date% %time%] Services : 90+ desactives (Start=4, effectifs apres reboot) >> "%LOG%" -echo [%date% %time%] Taches planifiees : 73+ desactivees >> "%LOG%" +echo [%date% %time%] Services : 110+ desactives (Start=4, effectifs apres reboot) >> "%LOG%" +echo [%date% %time%] Taches planifiees : 88+ desactivees >> "%LOG%" echo [%date% %time%] Apps UWP : 73+ supprimees >> "%LOG%" -echo [%date% %time%] Hosts : 57+ domaines telemetrie bloques >> "%LOG%" -echo [%date% %time%] Registre : 135+ cles vie privee/telemetrie/perf appliquees >> "%LOG%" +echo [%date% %time%] Hosts : 70+ domaines telemetrie bloques >> "%LOG%" +echo [%date% %time%] Registre : 150+ cles vie privee/telemetrie/perf appliquees >> "%LOG%" echo [%date% %time%] win11-setup.bat termine avec succes. Reboot recommande. >> "%LOG%" echo. echo Optimisation terminee. Un redemarrage est recommande pour finaliser. echo Consultez le log : C:\Windows\Temp\win11-setup.log -exit /b 0 +exit /b 0 \ No newline at end of file