Home AMX User Forum NetLinx Studio

How do I shut a PC down from Netlinx?

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?

Comments

  • A quick idea is to use AMX ctrl relays connected in parallel with PC power button.
  • jeffacojeffaco Posts: 121
    I wouldn't suggest a power relay. Just yanking power on a computer is a bad idea; work in progress can (and will) be lost. And wiring into most power switches can be difficult (these days, they're frequently 'all in one' designs right on a circuit board).

    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.
  • Spire_JeffSpire_Jeff Posts: 1,917
    I think what bogdan was trying to suggest was to put a contact closure in parallel with the power switch on the front of the computer case. These days computers don't use a physical switch for the power it is simply a momentary contact closure. You could pulse it to turn the computer on/off. If you do a roughly 8 second maintained closure, it will do a hard power off. Also, I believe that the new windows OSes recognize the power button press and can act according to settings in the control panel..... I think ;)

    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
  • Thanks Jeff for completing me. I should be more explicit.

    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.
  • pauldpauld Posts: 106
    Thanks for the ideas guys, I will have to check out the power button idea, as I don't do windows programming very much.

    Once again thanks for the ideas.
  • I wrote a PCLink application that could shutdown-reboot etc your computer through Netlinx. The zip file is too big to post here. But here is the link to download it.

    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.
  • Windows 2K and XP have a build in command line shutdown tool:

    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
  • Adding to my previous posting, with i!-PCLink/Web you could even elect to lauch a VBScript file on the target computer. This would give you more advanced control, such as prompting the user to abort the shutdown process , etc.

    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
  • There's also another application on the internet that's called PowerOff. This application alows remote control. This makes it possible to use it with IP_CLIENT_OPEN. And send a command string

    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
  • pauldpauld Posts: 106
    Originally posted by Robert Savage
    Windows 2K and XP have a build in command line shutdown tool:

    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


    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??
  • If you use PCLinkSystem, you can send the following commands to shutdown, logoff etc:

    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)
  • Well... it looks like i!-PCLink/Web does not handle command line switches very well. So you would actually need to create a batch file that has the command line switches embedded in it.
    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
  • Well it looks like the VBScript file I tried to attach to yesterday's posting did not make it.... so here it is again.
  • I almost forgot, there is another method using i!-PCLink/Web to execute a program on the PC.

    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'"
    )
  • Joe HebertJoe Hebert Posts: 2,159
    There?s an awesome freeware package called AutoIt which is by far the coolest scripting software I?ve ever run across for automating the Windows GUI. It has features that allow you to do things with Windows that you can?t do with VBScript or other scripting languages. The door to possibilities is unlocked and wide open with the combination of AutoIt and i!-PCLink/Web.

    Here?s the link where you can download a free copy:
    http://www.autoitscript.com/autoit3/downloads.php

    Joe
  • In the past, I have used UPS software to shutdown the the computers. I want to say it was APC software or one of the open source clients, I'm not sure anymore. It is much easier to use common protocol that works for many platforms. Just send the shutdown string and have UPS software do the rest. In this case the power was killed a few minutes later so the computers could reboot on a different drive and the computer would start when the power came back.

    Dan Nelson
  • Chrisj082Chrisj082 Posts: 1
    edited May 2019

    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.

Sign In or Register to comment.