winterknights 0 Report post Posted March 25, 2016 (edited) Hi, I could need some help urgently :-( It seems that I am trying something that can't be done? First to start an Synology NAS with a WOL command using wake.exe - working as a Batch! Parameters are a Problem and what I have seen in the web/Forum all efforts were not succesful. Could be complicated or me dumb ;-) Ok, second thing is to shutdown the NAS again - works as a Batch (plink.exe), too. But, for shutdown you have to use root and root password via SSH - again, parameters and even more complicated. Thought of using AutoIT because you can compile it and the user won't know pw - any ideas for using in AutoIT? ;-) Wake NAS: Got first part by workaround (instead of .bat .cmd now, left the .cmd in Win sys32-folder; no valuable data there): #include <GuiConstants.au3> GuiCreate("NAS_Control", 200, 460,-1, -1) $Radio_1 = GuiCtrlCreateRadio("Start NAS", 20, 40, 150, 20) $Radio_2 = GuiCtrlCreateRadio("Shutdown", 20, 80, 150, 20) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $Radio_1 MsgBox (0,"Checked", "Start NAS") RunWait(@ComSpec & " /c " & "c:\Windows\System32\WakeNAS.cmd") exitloop WORKS ;-) BUT... case $msg = $Radio_2 MsgBox (0,"Checked", "Shutdown") RunWait(@ComSpec & " /c " & '"c:\Windows\System32\plink" -ssh -pw -password user@192.168.xxx.yy -m"') Execute ("shutdown -h now") exitloop won't do, neither: ShellExecute("c:\Windows\System32\plink.exe" -ssh ("192.168.xxx.yy" -m) ("user") -pw ("password")) Don't get the Syntax, read for two days now, tried every Version I found in web...nothing! ANY SUGGESTIONS,PLEASE? Edited March 28, 2016 by winterknights changes Share this post Link to post Share on other sites
winterknights 0 Report post Posted March 31, 2016 On 25.03.2016 at 3:11 PM, winterknights said: Hi, I could need some help urgently :-( It seems that I am trying something that can't be done? First to start an Synology NAS with a WOL command using wake.exe - working as a Batch! Parameters are a Problem and what I have seen in the web/Forum all efforts were not succesful. Could be complicated or me dumb ;-) Ok, second thing is to shutdown the NAS again - works as a Batch (plink.exe), too. But, for shutdown you have to use root and root password via SSH - again, parameters and even more complicated. Thought of using AutoIT because you can compile it and the user won't know pw - any ideas for using in AutoIT? ;-) Wake NAS: @echo off %systemroot%\\System32\\wake.exe 00-00-00-00-00-00 192.168.123.255 echo Programm ausgeführt! pause Shutdown: plink -ssh -pw "xxxxxx" root@192.168.123.xx -m command.bat shutdown -h now This is what I was looking for: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $var = Ping("DiskStation",250) If $var Then #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Netzwerkcheck", 507, 248, 402, 14) GUISetBkColor(0x008000) $Label1 = GUICtrlCreateLabel("Das Gerät ist im Netz!", 108, 8, 290, 25, $SS_CENTER) GUICtrlSetFont(-1, 14, 800, 0, "Arial") GUICtrlSetBkColor(-1, 0xFFFFE1) $Pic1 = GUICtrlCreatePic("index.jpg", 84, 48, 338, 149) $Label2 = GUICtrlCreateLabel("Netzlaufwerk einsatzbereit", 29, 208, 449, 24, $SS_CENTER) GUICtrlSetFont(-1, 14, 800, 0, "Arial") GUICtrlSetBkColor(-1, 0xFFFFE1) $Radio_1 = GuiCtrlCreateRadio("Shutdown", 20, 40, 80, 20) $Radio_2 = GuiCtrlCreateRadio("Close", 20, 80, 80, 20) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $Radio_1 MsgBox (0,"Checked", "Shutdown NAS") Run(@ComSpec & " /c " & 'plink.exe -ssh DiskStation -l root -pw cdullr33 shutdown -h now', "", @SW_HIDE) Exit exitloop case $msg = $Radio_2 MsgBox (0,"Checked", "Close") exitloop EndSelect WEnd #EndRegion ### END Koda GUI section ### sleep (500) Else Run ("wolcmd.exe 001132555eb1 192.168.109.78 255.255.255.0 7") #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Netzwerkcheck", 523, 272, 419, 15) GUISetBkColor(0x800000) $Label1 = GUICtrlCreateLabel("Das Gerät ist nicht im Netz!", 84, 8, 354, 25, $SS_CENTER) GUICtrlSetFont(-1, 14, 800, 0, "Arial") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xFFFFE1) $Pic1 = GUICtrlCreatePic("index2.jpg", 92, 48, 338, 149) $Label2 = GUICtrlCreateLabel("Das Netzlaufwerk ist in ca. 2 Minuten einsatzbereit", 11, 232, 500, 24, $SS_CENTER) GUICtrlSetFont(-1, 12, 800, 0, "Arial") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xFFFFE1) $Label3 = GUICtrlCreateLabel("Es wird nun gestartet ... einen Moment Geduld!", 37, 200, 449, 24, $SS_CENTER) GUICtrlSetFont(-1, 14, 800, 0, "Arial") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xFFFFE1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### sleep (5000) EndIf :-) Borrowed and merged :-) Share this post Link to post Share on other sites
water 1,771 Report post Posted March 31, 2016 When posting code please use the code tags ("<>" in the editor) to make your script easier to read My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example ScriptsExcel - Example Scripts - WikiWord - WikiPowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support Tutorials:ADO - Wiki Share this post Link to post Share on other sites
AutoBert 160 Report post Posted March 31, 2016 Is related to: and using code-TAG's isn't his thing. Share this post Link to post Share on other sites