ตอนติดตั้ง Role หรือ Feature ใดๆ บน Windows Server 2016 Error ปรากฏว่ Server ต้อง Restart: "The request to add or remove features on the specified server failed. The operation cannot be completed, because the server that you specified requires a restart" OK Restart Server ลองติดตั้ง Role ใหม่ Error เดิมขึ้นซ้ำ Loop ไปเรื่อยๆ
ผลลัพธ์: ไม่สามารถ Install/Remove Roles/Features ใดๆ บน Windows Server ได้แม้ Restart Server และติดตั้ง Latest Updates แล้ว
Server Event Log (Event Viewer → Windows Logs → System) แสดง Error EventID 7041 Source Service Control Manager Description:
This service account does not have the required user right "Log on as a service".
แก้ไข: ต้อง Grant Logon as a Service Permissions ให้ "NT SERVICE\ALL SERVICES" (และ NT SERVICE\MSSQL$MICROSOFT##WID หาก Error เกี่ยวกับ WSUS Role หรือ SQL Server Role Installation)
- เปิด Local Group Policy Editor:
gpedit.msc - ไป Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment
- หา Policy Log on as a service
- เห็นว่าไม่มี
NT SERVICE\ALL SERVICESใน Policy นี้ ลอง Add: Add User or Group → NT SERVICE\ALL SERVICES Error: name not found
จะ Add Service Account เข้า Local Policy ยังไง? วิธีเดียวที่หาเจอ Grant "Log on as a service" Permissions ให้ NT SERVICE\ALL SERVICES คือใช้ Tool ntrights.exe (จาก Windows Server 2003 Resource Kit เก่า)
ดาวน์โหลดติดตั้ง Server 2003 Resource Kit (rktools.exe) Grant SeServiceLogonRight Permission ด้วยคำสั่งใน Elevated Command Prompt:
cd "C:\Program Files (x86)\Windows Resource Kits\Tools"
ntrights.exe +r SeServiceLogonRight -u "NT SERVICE\ALL SERVICES"
Granting SeServiceLogonRight to NT SERVICE\ALL SERVICES ... successful
หาก NETWORK SERVICE ไม่อยู่ใน Current Permissions List เพิ่ม Account นี้ด้วย หากจำเป็นเพิ่ม Permissions ให้ NT SERVICE\MSSQL$MICROSOFT##WID เหมือนกัน:
ntrights.exe +r SeServiceLogonRight -u "NT SERVICE\MSSQL$MICROSOFT##WID"
ตรวจสอบว่า NT SERVICE\ALL SERVICES ปรากฏใน "Log on as a service" Permissions ใน Group Policy Editor Console แล้ว
Restart Windows Server ลอง Install/Remove Role ใหม่ ไม่ควรมี Error อีกแล้ว