Good night Support,
Is there a way to use the Raspberry Pi 3b+, and then execute commands in Windows 10 Pro? Example: If there is no movement for 5 minutes, the monitors must dim. You do this in Windows with: Start+L (Windows-key+L)
Commands to be carried out by the Pi 3b+
Moderator: leecollings
- Pieter
- Posts: 8
- Joined: Wednesday 25 April 2018 23:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Almere, Nederland
Commands to be carried out by the Pi 3b+
Regards,
Pieter
English is not my language.
Forgive me if I make a language mistake
Pieter
English is not my language.
Forgive me if I make a language mistake
-
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Commands to be carried out by the Pi 3b+
One way would be to setup an SSH Server on the Windows host then use something like nircmd with sshpass (apt-get install sshpass) on the Raspberry.
Eg, from the Raspberry (not exact) to execute a command on the Windows PC, it would look something like this:
sshpass -p "PASSWORD" ssh "USERNAME"@"IPOFWINDOWSCOMPUTER" "pathtonircmd.exe nircmandcommand"
https://www.nirsoft.net/utils/nircmd.html
Eg, from the Raspberry (not exact) to execute a command on the Windows PC, it would look something like this:
sshpass -p "PASSWORD" ssh "USERNAME"@"IPOFWINDOWSCOMPUTER" "pathtonircmd.exe nircmandcommand"
https://www.nirsoft.net/utils/nircmd.html
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
- Egregius
- Posts: 2591
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Commands to be carried out by the Pi 3b+
This should do it: https://sourceforge.net/projects/winexe/
I hope it’s not judt for windows - L?
I hope it’s not judt for windows - L?
- Pieter
- Posts: 8
- Joined: Wednesday 25 April 2018 23:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Almere, Nederland
Re: Commands to be carried out by the Pi 3b+
Good morning ben53252642,
No matter what I do, the cursor keeps flashing. But beyond that, nothing happens to the monitor.
No matter what I do, the cursor keeps flashing. But beyond that, nothing happens to the monitor.
Regards,
Pieter
English is not my language.
Forgive me if I make a language mistake
Pieter
English is not my language.
Forgive me if I make a language mistake
-
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Commands to be carried out by the Pi 3b+
Personally I'm using this .bat file to turn the screen off on Windows 10
TurnoffScreen.bat
You can test it by pasting that code straight into cmd, be careful not to move the mouse (screens should turn off?).
TurnoffScreen.bat
Code: Select all
powershell -WindowStyle Hidden -NonInteractive (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)
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
- Pieter
- Posts: 8
- Joined: Wednesday 25 April 2018 23:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Almere, Nederland
Re: Commands to be carried out by the Pi 3b+
Hell yes! The screens all went out. And now in linux, can you help me a little bit?
Regards,
Pieter
English is not my language.
Forgive me if I make a language mistake
Pieter
English is not my language.
Forgive me if I make a language mistake
-
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Commands to be carried out by the Pi 3b+
On Windows:
1) Create folder in C drive called: scripts
2) In notepad paste the contents of this:
Save the file in the scripts folder on C drive, be sure the file is named exactly: TurnoffScreen.bat
When you go file save as in notepad, you will see its by default set to save as type "Text Documents", change that to "All Files" before saving.
3) Now you should be able to double click TurnoffScreen.bat in the scripts folder and it should work.
4) You now need to remotely tell Windows to run that file when you want the screens to turn off.
5) Setup OpenSSH server on Windows so we can connect to its command line remotely from the Raspberry, suggest follow this or similar guide:
https://www.bleepingcomputer.com/news/m ... sh-server/
6) Make sure you set a static IP address on the windows PC
On Raspberry:
1) apt-get install sshpass
2) ssh -l username STATICIPADDRESSOFWINDOWSPC
3) Make sure you can login with the above command to the Windows PC.
4) Now all you have to do is tell SSH to execute a command on the host Windows PC and automate the process
Eg:
1) Create folder in C drive called: scripts
2) In notepad paste the contents of this:
Code: Select all
powershell -WindowStyle Hidden -NonInteractive (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)
When you go file save as in notepad, you will see its by default set to save as type "Text Documents", change that to "All Files" before saving.
3) Now you should be able to double click TurnoffScreen.bat in the scripts folder and it should work.
4) You now need to remotely tell Windows to run that file when you want the screens to turn off.
5) Setup OpenSSH server on Windows so we can connect to its command line remotely from the Raspberry, suggest follow this or similar guide:
https://www.bleepingcomputer.com/news/m ... sh-server/
6) Make sure you set a static IP address on the windows PC
On Raspberry:
1) apt-get install sshpass
2) ssh -l username STATICIPADDRESSOFWINDOWSPC
3) Make sure you can login with the above command to the Windows PC.
4) Now all you have to do is tell SSH to execute a command on the host Windows PC and automate the process
Eg:
Code: Select all
sshpass -p "PASSWORD" ssh "USERNAME"@"IPOFWINDOWSCOMPUTER" "c:\scripts\TurnoffScreen.bat"
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
- Pieter
- Posts: 8
- Joined: Wednesday 25 April 2018 23:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Almere, Nederland
Re: Commands to be carried out by the Pi 3b+
Sorry for the delay. But I fell asleep!
> On Raspberry:
> 1) apt-get install sshpass
> 2) ssh -l username STATICIPADDRESSOFWINDOWSPC
I am getting an error here: Permission denied, please try again.
> 3) Make sure you can login with the above command to the Windows PC.
I can not login to my Windows 10 Pro PC, do you have any ideas?
> On Raspberry:
> 1) apt-get install sshpass
> 2) ssh -l username STATICIPADDRESSOFWINDOWSPC
I am getting an error here: Permission denied, please try again.
> 3) Make sure you can login with the above command to the Windows PC.
I can not login to my Windows 10 Pro PC, do you have any ideas?
Regards,
Pieter
English is not my language.
Forgive me if I make a language mistake
Pieter
English is not my language.
Forgive me if I make a language mistake
- Pieter
- Posts: 8
- Joined: Wednesday 25 April 2018 23:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Almere, Nederland
Re: Commands to be carried out by the Pi 3b+
No, that would be very much a waste of your and my timeEgregius wrote: ↑Wednesday 16 May 2018 6:17 This should do it: https://sourceforge.net/projects/winexe/
I hope it’s not judt for windows - L?

UPdate!!
I get one error message after another and it keeps on going. I do not get it installed. This is absolutely nothing for beginners! And that's why everything has been cleared away. With the following command: sudo rm -rf folderName. Bye bye WinExe.
https://www.raspberrypi.org/forums/view ... p?t=158795
https://www.raspberrypi.org/forums/view ... 36&t=50771
Regards,
Pieter
English is not my language.
Forgive me if I make a language mistake
Pieter
English is not my language.
Forgive me if I make a language mistake
Who is online
Users browsing this forum: gvandick and 0 guests