Force Logoff When Logon Hours Expire คืออะไร?
การตั้งค่า Group Policy (GPO) บังคับให้ผู้ใช้ Log off อัตโนมัติ เมื่อนอกเวลาที่อนุญาต (Logon Hours) ป้องกันการใช้งานระบบนอกเวลาทำงาน
เปิดใช้งานผ่าน Group Policy
- เปิด
gpmc.msc(Group Policy Management Console) - สร้าง/แก้ไข GPO > Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options
- หา "Network security: Force logoff when logon hours expire"
- ตั้งค่าเป็น Enabled
Logon Hours คืออะไร?
กำหนดเวลา/วันที่ที่ User ได้ Logon เข้า Domain ได้ ตั้งใน Active Directory Users and Computers (ADUC) > User Properties > Account > Logon Hours
Logon Hours vs Force Logoff
- Logon Hours: ป้องกัน Logon ใหม่ (แต่ Session เดิมอยู่ได้)
- Force Logoff: ตัด Session ที่ทำงานอยู่ทันทีเมื่อหมดเวลา
วิธี Force Logoff ทันที (Manual)
- Task Manager (Taskmgr) > Users Tab > คลิกขวา User > Sign off
- CMD:
logoff/server: - PowerShell:
Invoke-Command -ScriptBlock { logoff } -ComputerName
Logon Workstations (Restrict Computers)
ADUC > User > Account > Log On To... > ระบุ Computer Name ที่อนุญาตให้ Logon ได้
Best Practices
- ทดสอบกับ OU ทดสอบก่อน Apply ทั่ว Domain
- แจ้งให้ผู้ใช้ทราบล่วงหน้า (Policy Awareness)
- รวมกับ Fine-Grained Password Policy และ Account Lockout Policy
- Monitor Event ID 4647 (User Logoff) และ 4625 (Failed Logon)