you can do it with
gpo: computer configuration > administrative templates > system > power management > button settings
or
powershell (balanced power plan)
# Lid close action: 0 - Do nothing; 1 -...