First of all you should check if your shutdown.exe command is running, by doing the following steps manually.
-
Type on JUSTIN-COMPUTER
regedit(in “Search” or “Run”) and pressEnter. -
Either go to the following registry key:
Computer\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Systemor copy and paste the registry path to the address bar and pressEnter. -
Right-click
Systemfolder. -
Select “New → DWORD (32-bit) Value.”
-
Enter the label:
LocalAccountTokenFilterPolicy -
Double-click the value, and change it to “1.”
-
Close and exit the registry.
-
Reboot to confirm changes. (You can now shut down or restart your PC remotely.)
-
After restart → Next, click Search and type
Command Prompt. -
Right-click and select “Run as Administrator.”
-
At the Command Prompt type:
net use \\JUSTIN-COMPUTER /User:JUSTIN-COMPUTER\fals3illusionyour-passwordand pressEnter. -
Type
shutdown /r /m \\JUSTIN-COMPUTER /t 001and pressEnter.
If this then reboots your remote PC, then you can do further steps.
If all steps 1-12 are running manually, you now can create a batch file e.g. shutdown.bat with the following content:
net use \\JUSTIN-COMPUTER /User:JUSTIN-COMPUTER\fals3illusion your-password
c:\windows\system32\shutdown.exe /r /m \\JUSTIN-COMPUTER /t 001
.
place shutdown.bat into the following folder:
C:\Openhab-Folder\conf\sripts\
To auto-run a batch file as administrator, you need to create a shortcut for it. To create a shortcut, right-click the shutdown.bat, and select “Create shortcut”. This will place the shortcut in the same folder. Rename it to shut-down.bat
Once the shortcut has been created right-click it, select Properties from the context menu. On the Shortcut tab, you will see an Advanced button at the bottom. Click it.
Last step:
your rule:
val String results1 = executeCommandLine("C:\\Openhab-folder\\conf\\scripts\\shut-down.bat", 5000)

