I've been using nircmd to turn off the monitor/display of various PCs like so:
nircmd.exe cmdwait 1000 monitor off
The cmdwait 1000 part just adds a 1 second delay (to let the last keystroke and mouse movement end) before turning off the display. This has worked for 10+ years.
I just now came across a Win10 PC that actually goes to sleep from this command instead of just turning off the monitor. What could be causing this, and how can it be fixed?
The PC in question in an ASUS Zenbook. Let me know if any more information is needed.
Update: I also tried this WinAPI call via powershell to turn off the display, and it also results in the PC going to sleep:
(Add-Type -MemberDefinition "[DllImport(""user32.dll"")]`npublic static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);" -Name "Win32SendMessage" -Namespace Win32Functions -PassThru)::SendMessage(0xffff, 0x0112, 0xF170, 2)