New
#10
Sure. You could use this below instead for that. :)
Turn Off Display - Add to Desktop Context Menu in Windows
Sure. You could use this below instead for that. :)
Turn Off Display - Add to Desktop Context Menu in Windows
You can turn off the monitor the workstation without a 3rd party program with a PowerShell-script: Make a MonitorOff.ps1 for example in C:\ and create a shortcut with this target: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy UnRestricted -File C:\MonitorOff.ps1
Paste the following code inside the .ps1 file:
Code:# Turn display off by calling WindowsAPI. # SendMessage(HWND_BROADCAST,WM_SYSCOMMAND, SC_MONITORPOWER, POWER_OFF) # HWND_BROADCAST 0xffff # WM_SYSCOMMAND 0x0112 # SC_MONITORPOWER 0xf170 # POWER_OFF 0x0002 Add-Type -TypeDefinition ' using System; using System.Runtime.InteropServices; namespace Utilities { public static class Display { [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern IntPtr SendMessage( IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam ); public static void PowerOff () { SendMessage( (IntPtr)0xffff, // HWND_BROADCAST 0x0112, // WM_SYSCOMMAND (IntPtr)0xf170, // SC_MONITORPOWER (IntPtr)0x0002 // POWER_OFF ); } } } ' [Utilities.Display]::PowerOff() if ($Host.Name -eq 'ConsoleHost') {Stop-Process $PID}
Last edited by Brink; 12 Sep 2015 at 22:23. Reason: code box
I am going to use it on my Windows 10 PC. if it is work properly, I will post my experience here.