I couldn't find this anywhere online:
powercfg -setdcvalueindex SCHEME_CURRENT SUB_NONE CONSOLELOCK 1
powercfg -setacvalueindex SCHEME_CURRENT SUB_NONE CONSOLELOCK 1
The last digit enables or disables the setting: 0 = password not required; 1= password required