Page 2 of 3
Re: Shutdown Remote Windows PC
Posted: Friday 17 April 2015 18:57
by raxor
Shutdown Windows computer (windows 7) from domoticz: using Synology or raspberry as a Domoticz server
INSTRUCCIONS FOR RASPBERRY
you need samba-common package
Code: Select all
nano /home/pi/domoticz/scripts/shutdown_PC.sh
content of script
Code: Select all
#!/bin/sh
#Shutdown Computer
# IP of computer and admin user needed
net rpc -S 192.168.1.xx -U USER%PWD shutdown -t 1 -f
(-f parameter force shutdown)
+x script (execution permission)
Code: Select all
chmod +x /home/pi/domoticz/scripts/shutdown_PC.sh
INSTRUCCIONS FOR SYNOLOGY
synology
Code: Select all
nano /volume1/@appstore/domoticz/scripts/shutdown_PC.sh
content of script
Code: Select all
#!/bin/sh
#Shutdown Computer
# IP of computer and admin user needed
net rpc -S 192.168.1.xx -U USER%PWD shutdown -t 1 -f
(-f parameter force shutdown)
+x script (execution permission)
Code: Select all
chmod +x /volume1/@appstore/domoticz/scripts/shutdown_PC.sh
IN WINDOWS (both cases, synology or raspberry)
To no disable windows UAC you can insert reg info to accept RPC commands
In windows create reg file. enablerpcshutdown.reg
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system]
"LocalAccountTokenFilterPolicy"=dword:00000001
- Execute to add to registry (DOUBLE CLICK),
Enable remote registry service
- Execute CMD witch admin rights (search cmd in start button, right button in cmd.exe execute with admin rights)
Code: Select all
sc config RemoteRegistry start= auto
sc start RemoteRegistry
- reboot windows
In Domoticz create virtual switch
Switch type: push off button
Assign to off action:
(RASPBERRY)
"script://home/pi/domoticz/scripts/shutdown_PC.sh"
(SYNOLOGY)
"script://volume1/@appstore/domoticz/scripts/shutdown_PC.sh"
Save
Re: Shutdown Remote Windows PC
Posted: Saturday 18 April 2015 13:05
by Derik
This script is to restart . is there might also be a shutdown and startup script ?
And may i do so without a password / login on a pc
Re: Shutdown Remote Windows PC
Posted: Saturday 18 April 2015 13:17
by raxor
Nope, this script is to shutdown, and to start I use wake on lan virtual device in domoticz, is too easy, enable some values in bios menu from pc wake on events on energy management, in Windows, network controller setup, enable magic packet wake on, or wake on lan (WOL), you need mac address of your network card (pc), and IP of your network for broadcast, for example if your pc have ip 192.168.1.105 network value is 192.168.1.255.
ifconfig /all on command provide this values (cmd.exe)
If you don't like put your user/pass, you can create administrative user on pc to shutdown computer (admin rights of course).
Derik wrote:This script is to restart . is there might also be a shutdown and startup script ?
And may i do so without a password / login on a pc
Re: Shutdown Remote Windows PC
Posted: Monday 27 April 2015 8:11
by Derik
I think i have to start here: [ is that correct?]
If you don't like put your user/pass, you can create administrative user on pc to shutdown computer (admin rights of course).
And then this:
net rpc -S 192.168.1.xx -U USER%PWD shutdown -t 1 -f
How do i fill this line correct?
example user is king and pass is day.
net rpc -S 192.168.1.xx -U king%day shutdown -t 1 -f
Or do i not need the % sign
Please will you tell me how i can do this correct.
And do i need to install samba and the smbclient?
Re: Shutdown Remote Windows PC
Posted: Monday 27 April 2015 9:37
by raxor
Hi.
net rpc -S 192.168.1.xx -U king%day shutdown -t 1 -f
is correct, obviusly you need correct IP (change "xx" for your last ip digits)
And you need samba-common for "net rpc" command
In raspberry for example, (synology have samba-common )
ssh your domoticz
and test
net rpc -S 192.168.1.xx -U king%day shutdown -t 1 -f
Derik wrote:I think i have to start here: [ is that correct?]
If you don't like put your user/pass, you can create administrative user on pc to shutdown computer (admin rights of course).
And then this:
net rpc -S 192.168.1.xx -U USER%PWD shutdown -t 1 -f
How do i fill this line correct?
example user is king and pass is day.
net rpc -S 192.168.1.xx -U king%day shutdown -t 1 -f
Or do i not need the % sign
Please will you tell me how i can do this correct.
And do i need to install samba and the smbclient?
Re: Shutdown Remote Windows PC
Posted: Monday 27 April 2015 9:49
by Derik
@ raxtor.
And without a password
Please help me with:
you can create administrative user on pc to shutdown computer
Re: Shutdown Remote Windows PC
Posted: Monday 27 April 2015 10:15
by raxor
Whitout a password, user non admin.
Create a new normal user without password
Windows key + R
lusrmgr.msc
(users folder right button --> create user)
untick (user change pass next logon) and tick (password never expires, and cannot change pass)
If your windows 7 are professional or ultimate (not for home edition)
Windows key + R
secpol.msc
- Step-1.jpg (56.22 KiB) Viewed 18242 times
- Step-2.jpg (42.51 KiB) Viewed 18242 times
Add your user to this policies
"force shutdown from remote ...."
and
"Shutdown the system"
reboot
try
Code: Select all
net rpc -S 192.168.1.xx -U king% shutdown -t 1 -f
If doesn't work add pasword for this user and search info to remove other permissions like create profiles or install apps (to no compromise this system).
Sorry my english
I'm att office, i test later in home.
Derik wrote:@ raxtor.
And without a password
Please help me with:
you can create administrative user on pc to shutdown computer
Re: Shutdown Remote Windows PC
Posted: Wednesday 15 July 2015 20:42
by groetg
I use windows 10 beta and get this error when I give the following command through my rpi (putty):
pi@raspberrypi ~ $ net rpc -S 192.168.0.x -U user%password shutdown -t 1 -f
Could not initialise pipe \winreg. Error was NT_STATUS_OBJECT_NAME_NOT_FOUND
Re: Shutdown Remote Windows PC
Posted: Wednesday 22 July 2015 1:19
by Derik
I did:
- ScreenShot134.jpg (225.69 KiB) Viewed 17987 times
And:
- ScreenShot133.jpg (22.13 KiB) Viewed 17987 times
And the RPi stuf...
chmod etc.
And i get:
Code: Select all
pi@raspberrypi ~ $ net rpc -S 192.168.5.5 -U Domoticz% shutdown -t 1 -f
Could not connect to server 192.168.5.5
Connection failed: NT_STATUS_ACCOUNT_RESTRICTION
Could not connect to server 192.168.5.5
Connection failed: NT_STATUS_ACCOUNT_RESTRICTION
The problem is the regfile... [ i guess ]
Where and how must ik make that?
Re: Shutdown Remote Windows PC
Posted: Wednesday 22 July 2015 9:05
by Derik
Edit...
I did not sleep a lot his night.....
Only 1 pc i can shutdown, i am very happy.....
An other problem.
My laptop [ WiFi ] is not responding:
Code: Select all
pi@raspberrypi ~ $ net rpc -S 192.168.5.18 -U Domoticz%Domoticz shutdown -t 1 -fread_fd_with_timeout failed, read error = NT_STATUS_IO_TIMEOUT.
Receiving SMB: Server 192.168.5.18 stopped responding
Could not connect to server 192.168.5.18
Connection failed: NT_STATUS_BAD_NETWORK_NAME
read_fd_with_timeout failed, read error = NT_STATUS_IO_TIMEOUT.
Receiving SMB: Server 192.168.5.18 stopped responding
read_fd_with_timeout failed, read error = NT_STATUS_IO_TIMEOUT.
Receiving SMB: Server 192.168.5.18 stopped responding
Could not connect to server 192.168.5.18
Connection failed: NT_STATUS_BAD_NETWORK_NAME
Only what is bad network name?
Or Better, what is a good name?
Give it a other try:
Code: Select all
pi@raspberrypi ~ $ net rpc -S 192.168.5.18 -U Domoticz%Domoticz shutdown -t 1 -fCould not connect to server 192.168.5.18
Connection failed: NT_STATUS_UNSUCCESSFUL
Could not connect to server 192.168.5.18
Connection failed: NT_STATUS_UNSUCCESSFUL
What is here wrong?
Edit:
I make a setting in my WiFi adpater active, share the connection...
Try again:
Code: Select all
pi@raspberrypi ~ $ net rpc -S 192.168.5.18 -U Domoticz%Domoticz shutdown -t 1 -f
Could not connect to server 192.168.5.18
Connection failed: NT_STATUS_BAD_NETWORK_NAME
Could not initialise pipe \winreg. Error was NT_STATUS_OBJECT_NAME_NOT_FOUND
And Again:
Code: Select all
pi@raspberrypi ~ $ net rpc -S 192.168.5.18 -U Domoticz%Domoticz shutdown -t 1 -f
Shutdown of remote machine succeeded
And i am Happy....
Only why respond the pc so slow?
Edit last time:
Not react:
Code: Select all
pi@raspberrypi ~ $ net rpc -S 192.168.5.18 -U Domoticz%Domoticz shutdown -t 1 -f
Could not connect to server 192.168.5.18
Connection failed: NT_STATUS_BAD_NETWORK_NAME
Could not initialise pipe \winreg. Error was NT_STATUS_OBJECT_NAME_NOT_FOUND
I think the WiFi connection....?
Re: Shutdown Remote Windows PC
Posted: Wednesday 22 July 2015 9:41
by ThinkPad
Why not use this:
http://www.domotica-blog.nl/post/pc-net ... ia-zipabox
Seems quite easy.... Put the HTTP URL in a virtual switch.
Re: Shutdown Remote Windows PC
Posted: Wednesday 22 July 2015 9:44
by Derik
Re: Shutdown Remote Windows PC
Posted: Wednesday 22 July 2015 10:05
by Derik
Is it also possible on this way, to do this on a [ Android ] Tablet?
Or break the internet connection
Edit:
When i dus this as slave to master switch...
My slave crashed..
Re: Shutdown Remote Windows PC
Posted: Wednesday 16 September 2015 6:09
by diggs
Just wondering if anyone was using this.
I tried to use it by putting in the "
http://XXX.XXX.X.X:8000/?action=System.Shutdown"
It is in the "off action" of the switch but when I click it nothing happens.
If I paste the address into my browser, it shuts the machine down no problem.
DO I need to do anything with the http link in the off action part of the switch??
Re: Shutdown Remote Windows PC
Posted: Tuesday 08 December 2015 19:08
by Derik
mmmm
I upgrade my pc to Windows 10...
Al the settings are the same like my first time...[ was working great until i did the upgrade ]
Only my pc is not going down.
Are there other setting that i need in Win10??
I was so happy... that i can remote shutdown my pc...
Help or so..
Thanks
Re: Shutdown Remote Windows PC
Posted: Wednesday 09 December 2015 16:50
by jannl
Today I found out wake on lan is not really working for me. After the power returns to a PC, WOL does not work. Power is swtiched off to minimize electricity. PC takes about 30watts when switch off. Normally this works fine, only after a real power outage, the greenwave plug switches on, causing my PC to boot, which is basically only a problem on vacation.
So I wanted to try remote shutdown, so Domoticz could switch off the PC in case it is not switched on intentionally.
It seemed samba-common was already installed on my Pi, but 'net rpc' gives command not found.
Am I doing anything wrong? Any ideas?
Never mind: patience and google are my friends.
had to install samba-common-bin (after apt-get update && upgrade) and do some other windows 10 magic
Re: Shutdown Remote Windows PC
Posted: Friday 07 July 2017 16:37
by AlwinHummels
I tried to use the manual from raxor to shutdown my windows PC with a off button in Domoticz but nothing happens. when I use the command from the schript on shell it shuts down my PC as it should, so what did I miss?
I followed
this step by step
I''ve the latest win 10 build (Insidder) and use Domoticz on my RPi.
Hope someone can help me.
Re: Shutdown Remote Windows PC
Posted: Monday 10 June 2019 12:52
by smotx
raxor wrote: ↑Friday 17 April 2015 18:57
Shutdown Windows computer (windows 7) from domoticz: using Synology or raspberry as a Domoticz server
INSTRUCCIONS FOR RASPBERRY
you need samba-common package
Code: Select all
nano /home/pi/domoticz/scripts/shutdown_PC.sh
content of script
Code: Select all
#!/bin/sh
#Shutdown Computer
# IP of computer and admin user needed
net rpc -S 192.168.1.xx -U USER%PWD shutdown -t 1 -f
(-f parameter force shutdown)
+x script (execution permission)
Code: Select all
chmod +x /home/pi/domoticz/scripts/shutdown_PC.sh
INSTRUCCIONS FOR SYNOLOGY
synology
Code: Select all
nano /volume1/@appstore/domoticz/scripts/shutdown_PC.sh
content of script
Code: Select all
#!/bin/sh
#Shutdown Computer
# IP of computer and admin user needed
net rpc -S 192.168.1.xx -U USER%PWD shutdown -t 1 -f
(-f parameter force shutdown)
+x script (execution permission)
Code: Select all
chmod +x /volume1/@appstore/domoticz/scripts/shutdown_PC.sh
IN WINDOWS (both cases, synology or raspberry)
To no disable windows UAC you can insert reg info to accept RPC commands
In windows create reg file. enablerpcshutdown.reg
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system]
"LocalAccountTokenFilterPolicy"=dword:00000001
- Execute to add to registry (DOUBLE CLICK),
Enable remote registry service
- Execute CMD witch admin rights (search cmd in start button, right button in cmd.exe execute with admin rights)
Code: Select all
sc config RemoteRegistry start= auto
sc start RemoteRegistry
- reboot windows
In Domoticz create virtual switch
Switch type: push off button
Assign to off action:
(RASPBERRY)
"script://home/pi/domoticz/scripts/shutdown_PC.sh"
(SYNOLOGY)
"script://volume1/@appstore/domoticz/scripts/shutdown_PC.sh"
Save
Good, this ok for me with W10 PC.
Thx a lot.
Re: Shutdown Remote Windows PC
Posted: Sunday 01 September 2019 0:51
by strasburger47
Hello,
Instructions from raxor were brilliant and worked like a charm until update of windows 10 bringing possibility of login with PIN.
After that I tried many combinations and I was constantly receiving error after executing the command in console:
Connection failed: NT_STATUS_IO_TIMEOUT
It turned out I had to dig in windows defender firewall and tick all Remote Service Management and Remote Shutdown options to be allowed.
Re: Shutdown Remote Windows PC
Posted: Sunday 03 November 2019 9:31
by odorf
Hi
can You specify which settings You had to update?
Have the same issue with NT_STATUS_IO_TIMEOUT