Turn off Win10 display(s) via OpenSSH












0














There are a lot of solutions to turn off display locally on a Windows10 machine. They all are some form of the following SendMessage line. There's also little executables like nircmd that do this. However there seems to be some limitation when running any of those via OpenSSH. Since my OpenSSH is configured to use the exact same credentials as my local user i can't really figure out why nothing happens. The ps script versions return a simple 1, and solutions like nircmd just return nothing at all. Not even an error. Any insight what might happen here and how to make it work?



Sample script:




powershell (Add-Type '[DllImport("user32.dll")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)




Source



edit: maybe i should add that other nircmd options like mute audio work without any problems.










share|improve this question






















  • Some more utilities to try: Turn Off Monitor or Display Power Off Utility or ScreenOff.
    – harrymc
    Dec 10 at 14:03










  • Thx, but those all have the same effect. They work locally on the machine, but not executed via ssh. That leads me to believe that somehow the ssh can't see/enumerate/detect displays to shut off. But without any log or error message i'm out of ideas.
    – narfelchen
    Dec 10 at 17:33










  • Are you doing Windows-to-Windows?
    – harrymc
    Dec 10 at 19:36










  • Since you are using OpenSSH, this means you are going form Linux to Windows, as it really would not be a go to for Windows to Windows, just use normal Windows PSRemoting. Now, all that being said, why are you trying to turn off a Windows display from a Linux box remotely. Just curious, or are you on a local Windows using an SSH session, again, not sure why you'd want to do that.
    – postanote
    Dec 10 at 20:30










  • It's a simple convenience thing. I want to be able to switch the displays on my desktop on and off from a home automation system running on a raspberry pi. Of course there are solutions like automatic switch off in idle time for the displays but that's not on demand and i just like to switch between them at my convenience. Not the end of the world, just became a curiosity thing since everything else works (e.g. switching audio devices).
    – narfelchen
    Dec 11 at 6:02
















0














There are a lot of solutions to turn off display locally on a Windows10 machine. They all are some form of the following SendMessage line. There's also little executables like nircmd that do this. However there seems to be some limitation when running any of those via OpenSSH. Since my OpenSSH is configured to use the exact same credentials as my local user i can't really figure out why nothing happens. The ps script versions return a simple 1, and solutions like nircmd just return nothing at all. Not even an error. Any insight what might happen here and how to make it work?



Sample script:




powershell (Add-Type '[DllImport("user32.dll")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)




Source



edit: maybe i should add that other nircmd options like mute audio work without any problems.










share|improve this question






















  • Some more utilities to try: Turn Off Monitor or Display Power Off Utility or ScreenOff.
    – harrymc
    Dec 10 at 14:03










  • Thx, but those all have the same effect. They work locally on the machine, but not executed via ssh. That leads me to believe that somehow the ssh can't see/enumerate/detect displays to shut off. But without any log or error message i'm out of ideas.
    – narfelchen
    Dec 10 at 17:33










  • Are you doing Windows-to-Windows?
    – harrymc
    Dec 10 at 19:36










  • Since you are using OpenSSH, this means you are going form Linux to Windows, as it really would not be a go to for Windows to Windows, just use normal Windows PSRemoting. Now, all that being said, why are you trying to turn off a Windows display from a Linux box remotely. Just curious, or are you on a local Windows using an SSH session, again, not sure why you'd want to do that.
    – postanote
    Dec 10 at 20:30










  • It's a simple convenience thing. I want to be able to switch the displays on my desktop on and off from a home automation system running on a raspberry pi. Of course there are solutions like automatic switch off in idle time for the displays but that's not on demand and i just like to switch between them at my convenience. Not the end of the world, just became a curiosity thing since everything else works (e.g. switching audio devices).
    – narfelchen
    Dec 11 at 6:02














0












0








0







There are a lot of solutions to turn off display locally on a Windows10 machine. They all are some form of the following SendMessage line. There's also little executables like nircmd that do this. However there seems to be some limitation when running any of those via OpenSSH. Since my OpenSSH is configured to use the exact same credentials as my local user i can't really figure out why nothing happens. The ps script versions return a simple 1, and solutions like nircmd just return nothing at all. Not even an error. Any insight what might happen here and how to make it work?



Sample script:




powershell (Add-Type '[DllImport("user32.dll")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)




Source



edit: maybe i should add that other nircmd options like mute audio work without any problems.










share|improve this question













There are a lot of solutions to turn off display locally on a Windows10 machine. They all are some form of the following SendMessage line. There's also little executables like nircmd that do this. However there seems to be some limitation when running any of those via OpenSSH. Since my OpenSSH is configured to use the exact same credentials as my local user i can't really figure out why nothing happens. The ps script versions return a simple 1, and solutions like nircmd just return nothing at all. Not even an error. Any insight what might happen here and how to make it work?



Sample script:




powershell (Add-Type '[DllImport("user32.dll")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)




Source



edit: maybe i should add that other nircmd options like mute audio work without any problems.







ssh powershell openssh






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 10 at 13:10









narfelchen

1




1












  • Some more utilities to try: Turn Off Monitor or Display Power Off Utility or ScreenOff.
    – harrymc
    Dec 10 at 14:03










  • Thx, but those all have the same effect. They work locally on the machine, but not executed via ssh. That leads me to believe that somehow the ssh can't see/enumerate/detect displays to shut off. But without any log or error message i'm out of ideas.
    – narfelchen
    Dec 10 at 17:33










  • Are you doing Windows-to-Windows?
    – harrymc
    Dec 10 at 19:36










  • Since you are using OpenSSH, this means you are going form Linux to Windows, as it really would not be a go to for Windows to Windows, just use normal Windows PSRemoting. Now, all that being said, why are you trying to turn off a Windows display from a Linux box remotely. Just curious, or are you on a local Windows using an SSH session, again, not sure why you'd want to do that.
    – postanote
    Dec 10 at 20:30










  • It's a simple convenience thing. I want to be able to switch the displays on my desktop on and off from a home automation system running on a raspberry pi. Of course there are solutions like automatic switch off in idle time for the displays but that's not on demand and i just like to switch between them at my convenience. Not the end of the world, just became a curiosity thing since everything else works (e.g. switching audio devices).
    – narfelchen
    Dec 11 at 6:02


















  • Some more utilities to try: Turn Off Monitor or Display Power Off Utility or ScreenOff.
    – harrymc
    Dec 10 at 14:03










  • Thx, but those all have the same effect. They work locally on the machine, but not executed via ssh. That leads me to believe that somehow the ssh can't see/enumerate/detect displays to shut off. But without any log or error message i'm out of ideas.
    – narfelchen
    Dec 10 at 17:33










  • Are you doing Windows-to-Windows?
    – harrymc
    Dec 10 at 19:36










  • Since you are using OpenSSH, this means you are going form Linux to Windows, as it really would not be a go to for Windows to Windows, just use normal Windows PSRemoting. Now, all that being said, why are you trying to turn off a Windows display from a Linux box remotely. Just curious, or are you on a local Windows using an SSH session, again, not sure why you'd want to do that.
    – postanote
    Dec 10 at 20:30










  • It's a simple convenience thing. I want to be able to switch the displays on my desktop on and off from a home automation system running on a raspberry pi. Of course there are solutions like automatic switch off in idle time for the displays but that's not on demand and i just like to switch between them at my convenience. Not the end of the world, just became a curiosity thing since everything else works (e.g. switching audio devices).
    – narfelchen
    Dec 11 at 6:02
















Some more utilities to try: Turn Off Monitor or Display Power Off Utility or ScreenOff.
– harrymc
Dec 10 at 14:03




Some more utilities to try: Turn Off Monitor or Display Power Off Utility or ScreenOff.
– harrymc
Dec 10 at 14:03












Thx, but those all have the same effect. They work locally on the machine, but not executed via ssh. That leads me to believe that somehow the ssh can't see/enumerate/detect displays to shut off. But without any log or error message i'm out of ideas.
– narfelchen
Dec 10 at 17:33




Thx, but those all have the same effect. They work locally on the machine, but not executed via ssh. That leads me to believe that somehow the ssh can't see/enumerate/detect displays to shut off. But without any log or error message i'm out of ideas.
– narfelchen
Dec 10 at 17:33












Are you doing Windows-to-Windows?
– harrymc
Dec 10 at 19:36




Are you doing Windows-to-Windows?
– harrymc
Dec 10 at 19:36












Since you are using OpenSSH, this means you are going form Linux to Windows, as it really would not be a go to for Windows to Windows, just use normal Windows PSRemoting. Now, all that being said, why are you trying to turn off a Windows display from a Linux box remotely. Just curious, or are you on a local Windows using an SSH session, again, not sure why you'd want to do that.
– postanote
Dec 10 at 20:30




Since you are using OpenSSH, this means you are going form Linux to Windows, as it really would not be a go to for Windows to Windows, just use normal Windows PSRemoting. Now, all that being said, why are you trying to turn off a Windows display from a Linux box remotely. Just curious, or are you on a local Windows using an SSH session, again, not sure why you'd want to do that.
– postanote
Dec 10 at 20:30












It's a simple convenience thing. I want to be able to switch the displays on my desktop on and off from a home automation system running on a raspberry pi. Of course there are solutions like automatic switch off in idle time for the displays but that's not on demand and i just like to switch between them at my convenience. Not the end of the world, just became a curiosity thing since everything else works (e.g. switching audio devices).
– narfelchen
Dec 11 at 6:02




It's a simple convenience thing. I want to be able to switch the displays on my desktop on and off from a home automation system running on a raspberry pi. Of course there are solutions like automatic switch off in idle time for the displays but that's not on demand and i just like to switch between them at my convenience. Not the end of the world, just became a curiosity thing since everything else works (e.g. switching audio devices).
– narfelchen
Dec 11 at 6:02















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1382319%2fturn-off-win10-displays-via-openssh%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1382319%2fturn-off-win10-displays-via-openssh%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕