How do I shut a PC down from Netlinx?
pauld
Posts: 106
Hi,
I have a job with nextlinx master and a G4 TP, I already have Wake on Lan figured out to turn the PC on. Now I need a way to turn the PC off with no user action(client Requested). I would prefer to do this with no extra hardware. I know Windows XP has a "Shutdown" command. Is there any way to trigger that command from Netlinx? Any Ideas?
I have a job with nextlinx master and a G4 TP, I already have Wake on Lan figured out to turn the PC on. Now I need a way to turn the PC off with no user action(client Requested). I would prefer to do this with no extra hardware. I know Windows XP has a "Shutdown" command. Is there any way to trigger that command from Netlinx? Any Ideas?
0
Comments
Windows does have remote shutdown capabilities, but talking the Windows protocol in order to execute it would be painful, most likely. I've never tried to write code to transmit those bits, but with all the security going into Windows these days, it's not something I'd be enthusiastic about.
Probably an easier path is to write a little service installed on the Windows system that listens on a TCP/IP port for NetLinx commands and executes a Windows shutdown via the Windows API. The service would be pretty trivial to write (likely an hour or two at the most if you know Windows programming at all).
Then you control the TCP/IP protocol from the NetLinx system to the Windows system - you can do anything you want there, and trigging the shutdown would involving connecting to the Windows service you wrote on a known port and sending the shutdown signal. Just a few lines of NetLinx code.
A seperate program in windows would probably be the best way, but the contact closure could add that little extra bit to deal with PC lockups if needed.
Jeff
I hade in mind the option with little piece of software but you know Windows and all applications, If windows is stuck then we are in trouble.
Good lock.
Once again thanks for the ideas.
Tip. After shutdown, the device becomes offline than, you can power any power relay
http://www.inter.nl/AMX/InternetInside/i!-PCLinkSystem.zip
Have fun with it.
Here is a link to a Microsoft article that fully describes the shutdown command:
http://support.microsoft.com/?kbid=317371
I tested on my XP PC, "shutdown.exe -s" and it did properly shutdown the PC.
You could install and run AMX i!-PCLink/Web on the target computer, then simply execute this "shutdown.exe". I know, the name "i!-PCLink/Web" is a little confusing, but with this application to can remotely (from NetLinx) execute any program, batch file, internet address, or command line utility. This is a very simple task to do with i!-PCLink/Web.
Here is a link to the i!-PCLink/Web uility on the AMX website.
http://www.amx.com/internet-inside.asp?module=PCLink/Web&t=&p=tcs_ii
Hope this help,
Thanks,
Robert Savage
AMX Engineering
Attached is a sample VBScript file for Windows XP that starts the shutdown process with a 2 minute timer. It then prompts the user to ABORT the shutdown if they wish. If they do choose to ABORT, the script then calls the shutdown utility with the abort flag.
To execute a VBScript file from command line, you must use the WSCRIPT command. i.e.:
wscript.exe c:\shutdown.vbs
Robert Savage
AMX Engineering
The program can be downloaded from this link:
http://users.pandora.be/jbosman/pwroff30.zip
The program is freeware
The documentation can be found on:
http://users.pandora.be/jbosman/poweroff/poweroff.htm
Ok, if I am reading this i!-PCLink/Web documentation correctly, than all I have to do is define the internet inside device, install the PC software and use the following line to shutdown the pc:
Send_Command dvWEB," 'OPEN-shutdown.exe -s' "
That should shutdown the PC,
Correct??
SEND_COMMAND dvPC,'EXITWINDOWS-POWEROFF' (Exit windows power off)
SEND_COMMAND dvPC,'EXITWINDOWS-LOGOFF' (Exit windows log off)
SEND_COMMAND dvPC,'EXITWINDOWS-REBOOT' (Exit windows reboot)
SEND_COMMAND dvPC,'EXITWINDOWS-SHUTDOWN' (Exit windows shutdown)
SEND_COMMAND dvPC,'EXITWINDOWS-FORCE' (Exit windows force)
SEND_COMMAND dvPC,'EXITWINDOWS-FORCEIFHUNG' (Exit windows force if hung up)
Then i!-PCLink/Web would simply call the batch file.
I have tested this with i!-PCLink/Web and it is working on my XP computer. I have attached the batch file to this posting.
First you would send the change directory command to i!-PCLink/Web to the location you placed the batch file:
SEND_COMMAND dvPCLinkWeb, "'CD-C:\windows\system32'"
Next, send the OPEN command to launch the batch file:
SEND_COMMAND dvPCLinkWeb, "'OPEN-PCLshutdown.bat'"
Thanks,
Robert Savage
AMX Engineering
If you simply use a SEND_STRING to the PCLinkWeb device, it will launch the full path of the string provided:
If you choose the batch file method you would use a command like this:
SEND_STRING dvPCLinkWeb, "'C:\Windows\System32\PCLshutdown.bat'"
If you choose the VBScript method you would use a command like this:
SEND_STRING dvPCLinkWeb, "'C:\Windows\System32\shutdown.vbs'"
(As a side note, if you actually put the batch or VBScript file in the System32 directory, then they will automatically be in the computers path. Thus you do not have to provide the full path for the SEND_STRING command:
SEND_STRING dvPCLinkWeb, "'PCLshutdown.bat'"
)
Here?s the link where you can download a free copy:
http://www.autoitscript.com/autoit3/downloads.php
Joe
Dan Nelson
Sorry for reviving an old thread, I still use i!-PCLinkWeb from time to time.. its crazy its not on the AMX site for download anymore.. would be great if they updated their software too , such a handy tool to have..
PS if anyone wants a copy let me know
Hello,
I'm very interested in this software! I searched everywhere on the AMX site!
Can you send me a download link?
@Babier7, take a look at MCE Controller - https://github.com/tig/mcec/wiki Please ensure Wake On Lan is enabled for the PC.
We use MCE Controller in our Student Training Centers to control student PCs.