⚠️ คำเตือนสำคัญ: ไม่ควรปิด Network Security / Windows Security
**ปิด Windows Security (Windows Defender) ทำให้เครื่องคอมพิวเตอร์เปราะบางต่อมัลแวร์ รูทคิท รैनซ์มเวร์ และการโจมตีจากเครือข่าย** — Microsoft **ไม่แนะนำ** และอาจทำให้ **ไม่ได้รับการปกป้องจาก Windows Update / Defender Definitions**
หากต้องการปิดชั่วคราวเพื่อ Troubleshooting / Compatibility Testing ให้ **เปิดกลับทันที** หลังเสร็จสิ้น
วิธีปิด Real-time Protection (Windows Defender Antivirus)
- Win+I → **Settings** → **Privacy & Security** → **Windows Security**
- คลิก **Virus & threat protection**
- คลิก **Manage settings** (Virus & threat protection settings)
- ปิด **Real-time protection** → **Off**
- หมายเหตุ: จะเปิดกลับอัตโนมัติหลังพักคราว (Tamper Protection) — ต้องปิด Tamper Protection ก่อน (ไม่แนะนำ)
วิธีปิด Windows Defender Firewall
- Win+I → **Settings** → **Privacy & Security** → **Windows Security**
- คลิก **Firewall & network protection**
- เลือก Network Profile: **Domain / Private / Public**
- ปิด **Microsoft Defender Firewall** → **Off
- หรือ: Control Panel → **Windows Defender Firewall** → **Turn Windows Defender Firewall on or off** → Turn off (ทั้ง Private/Public)
วิธีปิด Network Discovery & File Sharing
- Settings → **Network & Internet** → **Advanced network settings** → **Advanced sharing settings**
- **Private Network**: ปิด **Network discovery** + **File and printer sharing**
- **Public Network**: ปิด **Network discovery** + **File and printer sharing** (ควรเป็นค่า Default)
วิธีปิด Network Adapter (ตัดเครือข่ายโดยสิ้นเชิง)
- Win+R → `ncpa.cpl`
- คลิกขวา **Wi-Fi / Ethernet Adapter** → **Disable
- หรือ: Settings → Network & Internet → Advanced Network Settings → **Disable** บน Adapter นั้น
คำสั่ง PowerShell (Admin) สำหรับ Automation
# ปิด Real-time Protection (ต้องปิด Tamper Protection ก่อน) Set-MpPreference -DisableRealtimeMonitoring $true # ปิด Firewall (ทั้ง 3 Profile) Set-NetFirewallProfile -All -Enabled False # ปิด Network Discovery Set-NetFirewallProfile -Profile Domain,Private,Public -EnableNetworkDiscovery False # ปิด File & Printer Sharing Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled False
สิ่งที่ควรทำแทนการปิด Security
| ปัญหา | วิธีแก้ที่ปลอดภัยกว่า |
|---|---|
| โปรแกรม/เกมส์ ถูก Block | เพิ่ม **Exclusion** ใน Windows Security → Virus & Threat Protection → Manage Settings → Exclusions |
| Port ถูก Block | สร้าง **Inbound/Outbound Rule** ใน `wf.msc` Allow Port/Protocol/Application เฉพาะที่ต้องการ |
| False Positive | Submit Sample ให้ Microsoft, เพิ่ม Exclusion ชั่วคราว, ใช้ Controlled Folder Access แบบ Audit Mode |
| Performance Issue | ตั้งค่า **Scan Schedule** ให้ทำงานเวลาว่าง, Exclude Development Folders (node_modules, .git, build) |
| Testing Malware/Sample | ใช้ **VM Isolated** (VirtualBox, VMware, Hyper-V) + Snapshot — **ไม่เคยทดสอบบน Host จริง** |
Windows Security Center — ควรปิดหรือไม่?
ไม่ควรปิด** — Security Center คือ Dashboard รวมสถานะ Antivirus, Firewall, App & Browser Control, Device Security, Account Protection — การปิดมันไม่เพิ่มประสิทธิภาพ แต่ทำให้ **ไม่เห็นสถานะความปลอดภัย**
สรุป
- ❌ **อย่าปิด Windows Security / Defender / Firewall อย่างถาวร**
- ✅ ใช้ **Exclusions, Custom Firewall Rules, Audit Mode** แทน
- ✅ ทดสอบมัลแวร์/ซอฟต์แวร์น่าสงสัยใน **VM แยกต่างหาก (Isolated, No Network / Host-only)**
- ✅ หากต้องปิดชั่วคราว: **ตั้ง Timer / Reminder ให้เปิดกลับภายใน 1 ชั่วโมง**