From f829e603086dd5c31b1b6a88fa0203823c78b762 Mon Sep 17 00:00:00 2001 From: Johnny Date: Mon, 6 Oct 2025 07:57:20 +0000 Subject: [PATCH] Ajouter wifilock.ps1 --- wifilock.ps1 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 wifilock.ps1 diff --git a/wifilock.ps1 b/wifilock.ps1 new file mode 100644 index 0000000..505a5d0 --- /dev/null +++ b/wifilock.ps1 @@ -0,0 +1,24 @@ +# Nom du réseau autorisé +$allowedSSID = "ProfsH3" + +# Obtenir la liste des profils Wi-Fi enregistrés +$wifiProfiles = netsh wlan show profiles | Select-String "Profil Tous les utilisateurs" | ForEach-Object { + ($_ -split ":")[1].Trim() +} + +# Supprimer tous les profils sauf "ProfsH3" +foreach ($profile in $wifiProfiles) { + if ($profile -ne $allowedSSID) { + Write-Output "Suppression du profil Wi-Fi : $profile" + netsh wlan delete profile name="$profile" + } +} + +# Désactivation de la connexion automatique aux nouveaux réseaux +netsh wlan set blockednetworks display=show +netsh wlan add filter permission=denyall networktype=infrastructure + +# Autoriser uniquement le réseau "ProfsH3" +netsh wlan add filter permission=allow ssid="$allowedSSID" networktype=infrastructure + +Write-Host "`n✅ Seul le réseau Wi-Fi '$allowedSSID' est désormais autorisé." -ForegroundColor Green