Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows 10

ปิด Wi-Fi อัตโนมัติเมื่อเสียบสาย LAN (Ethernet) ใน Windows 10

หากมีหลาย Wi-Fi Networks Windows 10 จะเลือก Wireless Network ที่มี Signal แรงที่สุดโดยอัตโนมัติ (ไม่สนใจ Speed หรือจำนวนอุปกรณ์ที่เชื่อมต่อ) แต่เมื่อเชื่อมต่อคอมพิวเตอร์ (Laptop) เข้าสู่ Wired Ethernet Network Windows ยังคงใช้ Wi-Fi Network อยู่ แม้ Ethernet Connection จะมี Speed สูงกว่ามาก เสถียรกว่า และไม่ได้รับผลกระทบจาก Interference เพื่อสลับไปใช้ Cable Ethernet Connection User ต้อง Disable Wi-Fi Connection ด้วยตนเองทุกครั้ง มาดูวิธีปิด Wi-Fi อัตโนมัติเมื่อเสียบสาย LAN

WLAN Switching Options ใน BIOS/UEFI

Vendor คอมพิวเตอร์หลายแห่งมี Implementation ของ LAN/WLAN Switching Technology ของตัวเอง (อาจชื่อต่างกัน) เทคโนโลยีนี้หมายถึงบนคอมพิวเตอร์ผู้ใช้ จะมี Network Adapter เพียงตัวเดียวที่ส่งข้อมูลพร้อมกันได้ หากขณะใช้ Wi-Fi Network มี Ethernet Connection ที่มี Priority สูงกว่าปรากฏบนอุปกรณ์ Wi-Fi Adapter ควรเข้า Standby Mode อัตโนมัติ ดังนั้นจึงประหยัด Battery และลด Load Wireless Wi-Fi Network

สามารถเปิดใช้งาน LAN/WLAN Switching Option ใน BIOS/UEFI Settings หรือใน Properties ของ Wireless Network Adapter Driver (ขึ้นอยู่กับ Hardware Manufacturer)

Restart คอมพิวเตอร์เข้า UEFI/BIOS Settings หาและ Enable LAN/WLAN Switching option (บนอุปกรณ์ HP) หรือ Wireless Radio Control (บน Dell)

ฟีเจอร์นี้อาจชื่อต่างกันหรือไม่มีใน BIOS/UEFI จาก Manufacturer อื่น

"Disable Upon Wired Connect" ใน Properties ของ Wi-Fi Adapter

ใน Settings ของบาง Wi-Fi Adapter Drivers มี Option ปิด Wi-Fi อัตโนมัติถ้าพบ High-speed Ethernet Connection

เปิด Network and Sharing Center ใน Windows 10 เปิด Properties ของ Wi-Fi Adapter คลิก Configure

ใน Network Adapter Properties ไปแท็บ Advanced หา Disabled Upon Wired Connect ในรายการ Wi-Fi Adapter Options เปลี่ยนค่าเป็น Enabled บันทึกการเปลี่ยนแปลง

ด้วย Option นี้ Driver จะ Disconnect จาก Wi-Fi Network หากตรวจพบ Active Ethernet Connection

Option นี้ไม่รองรับทุกโมเดล Wi-Fi Card Drivers หากไม่มี Option นี้ การสลับไป Ethernet อัตโนมัติยังทำได้ด้วย PowerShell Script

ใช้ PowerShell ปิด Wi-Fi เมื่อมี Ethernet Connection

เพื่อ Enable/Disable WLAN Adapter อัตโนมัติ สามารถเขียน Script เองและ Trigger ที่ Event ของ Link ปรากฏบน Wired LAN Interface (Event-ID: 32 — Network link is established) และ (Event-ID: 27 – Network link is disconnected) แต่มี Solution สำเร็จรูปสำหรับ PowerShell

เพื่อปิด Wi-Fi Adapter อัตโนมัติเมื่อคอมพิวเตอร์เชื่อมต่อ Wired Ethernet Network สามารถใช้ PowerShell Script สำเร็จรูป — WLAN Manager (Original version: https://gallery.technet.microsoft.com/scriptcenter/WLAN-Manager-f438a4d7) หา Version ใหม่กว่าที่รองรับ Windows 10 ดีกว่าและ Detect Virtual Adapters ถูกต้องบน GitHub: https://github.com/jchristens/Install-WLANManager

PowerShell Script นี้สร้าง Scheduled Task ใหม่ที่รัน Script อีกตัวตอน System Boot Script ตรวจสอบ Active Network Adapters เป็นประจำ หากตรวจพบ LAN (Ethernet) Connection ใดๆ WLAN Interface จะถูก Disable อัตโนมัติ หาก LAN Cable ถูกถอดออก Script จะ Enable Wireless Wi-Fi Adapters กลับ

Script ประกอบ 2 ไฟล์:

  • PSModule-WLANManager.psm1
  • WLANManager.ps1

วิธีติดตั้ง WLAN Manager ใน Windows 10

เปิด Elevated PowerShell Prompt อนุญาตรัน PS1 Scripts:

Set-ExecutionPolicy RemoteSigned

ติดตั้ง Script ในระบบ:

.\WLANManager.ps1 -Install:System

Script อาจติดตั้งรันจาก User Account (Install:User) หรือ Local System (Install:System)

สามารถทำให้ Script แจ้งเตือน User ตอนสลับระหว่าง Wi-Fi และ LAN Networks:

.\WLANManager.ps1 -Install:User -BalloonTip:$true

ตรวจสอบว่า WLAN Manager Task ใหม่ปรากฏใน Task Scheduler

Restart คอมพิวเตอร์ หลัง Startup Scheduler จะรัน C:\Program Files\WLANManager\WLANManager.ps1 Script ที่ตรวจสอบ Network Connections ทุกวินาที หากตรวจพบ LAN Connection Wi-Fi Adapters ทั้งหมดจะถูก Disable หาก LAN Cable ถอดออก Script จะ Enable Wireless Wi-Fi Adapters อัตโนมัติ

WLAN Manager Script ทำงานได้ดีบน Windows 10, Windows 8.1 และ 7

เคล็ดลับ เพื่อลบ WLAN Manager Script รันคำสั่ง: .\WLANManager.ps1 Remove:System

GPO ปิด Non-Domain Wireless Networks เมื่อเชื่อมต่อ LAN

ใน GPO มี Setting แยกที่อนุญาตให้ปิด Wi-Fi Connections เมื่อคอมพิวเตอร์เชื่อมต่อ Corporate Domain Network ผ่าน LAN Policy อยู่ที่ Section Computer Configuration → Policies → Administrative Templates → Network → Windows Connection Manager ชื่อ Prohibit connection to non-domain networks when connected to domain authenticated network Policy ปรากฏตั้งแต่ Windows 8 / Windows Server 2012 ขึ้นไป

Policy นี้ป้องกันไม่ให้คอมพิวเตอร์เชื่อมต่อ Domain และ Non-Domain Networks พร้อมกันได้

อย่างไรก็ตาม หาก Enable Policy นี้ อาจเจอปัญหาตอนเชื่อมต่อ Wi-Fi Network หากมี Additional Interfaces บนคอมพิวเตอร์ (เช่น Loopback หรือ Virtualization Software สร้างขึ้น)