Home AMX User Forum NetLinx Studio
Options

Remote control of PC power(shutdown) and pc wake-on-lan from Netlinx via IP?

I've read some of the older posts on this subject and im not sure if any of the proposed solutions worked for the pc power off (shutdown) via netlinx? The wake-on-lan via netlinx seems to be a simple task though. Considering the posts on the subject to do this are a few years old, is there a new, simple or elegant soultion to shutting down a pc from netlinx? I have been researching this and maybe the i!-PCLink/Web is the only way to go. I was hoping that I did not have to install this software on the pcs that I want to control power off (shutdown). Anybody have suggestions to do this otherwise?

Comments

  • Options
    HedbergHedberg Posts: 671
    I experimented with this a little a couple years ago. If you have a computer with a telnet server, you can log into it with Netlinx (see the threads about getting Netlinx to work with a real Telnet server). Then you can execute any function for which there is a "DOS" (command line interface) command. If you can do it with 'run' cmd, you can do it from telnet. shutdown (I believe) is one of the commands. There are probably other ways to do this. XP pro has a built in telnet server, I don't know about windows 7. Surely there are freeware telnet servers available.
    I'm sure that you could train Netlinx to interface with a more secure shell (SSH?) but I've never done it. If I had to do that, I'd watch putty interface with a SSH through Wireshark and then mimic that in Netlinx. For sure there is a freeware SSH server.


    As for wake on lan, I'm not at all sure how that works. I recently found some free utilities by a company called "Radmin" that include a wake on lan utility (client, I guess). You might check that out and see if you can use wireshark to see how it does its thing. Search for free lan utilities and you'll find it. The utility that I am using is "Advanced IP Scanner" which will find active hosts on your network by IP#.
  • Options
    viningvining Posts: 4,368
    From what I remember of WOL you have to first enable WOL in the PC's bios setting and the WOL string you need to send the PC is $FF (6 times) followed by the PC's mac address 16 times. You should easily find info on this by searching or in Wikipedia.
  • Options
    HedbergHedberg Posts: 671
    Hey! You're looking at the documentation. That's no fair.
  • Options
    viningvining Posts: 4,368
    Hedberg wrote: »
    Hey! You're looking at the documentation. That's no fair.
    Not true! I would never look at documentation. :) Actually, I was looking into this about 6 months ago and vaguely remembered what I read and then looked at the function I wrote to see what the string was since my memory isn't really that good anymore.
  • Options
    GuybGuyb Posts: 2
    Yea, I experimented with the telnet session from a remote cp into the target pc and was able to remotely shut down the pc with the shutdown -s command and also remotely runing a batch file on the target pc. On the target XP pc I had to create an additional user with admin rights and enable the telnet server service built into XP. I will probably need it to work on remotely shutting down windows 7 machines though. Just had not done this through netlinx yet. I was hoping some one else may have had this telnet method or altenate method working/running on a netlinx controller through ethernet to a pc on the same network so I could get some real wolrd feedback on how difficult/involved the netlinx code is to do the shutdown.
  • Options
    DHawthorneDHawthorne Posts: 4,584
    vining wrote: »
    Not true! I would never look at documentation. :) Actually, I was looking into this about 6 months ago and vaguely remembered what I read and then looked at the function I wrote to see what the string was since my memory isn't really that good anymore.

    They say the mind is the first thing to go. I forget what the third thing is.
  • Options
    AMXJeffAMXJeff Posts: 450
    i!-PCLink/Web
    Guyb wrote: »
    I've read some of the older posts on this subject and im not sure if any of the proposed solutions worked for the pc power off (shutdown) via netlinx? The wake-on-lan via netlinx seems to be a simple task though. Considering the posts on the subject to do this are a few years old, is there a new, simple or elegant soultion to shutting down a pc from netlinx? I have been researching this and maybe the i!-PCLink/Web is the only way to go. I was hoping that I did not have to install this software on the pcs that I want to control power off (shutdown). Anybody have suggestions to do this otherwise?

    I think one of the most mis-named application AMX has written is i!-PCLink/Web. This application allows almost full control of a PC. It allows you access to many of the Win32 API functions. Including SHUTDOWN of the PC.

    http://www.amx.com/techcenter/downloadConfirm.asp?fn=/assets/applicationFiles/i!-PCLinkWebSetup.exe

    SEND_COMMAND vdvPCLINK,'COMPUTER-SHUTDOWN'

    To Turn on a computer the only way is WAKE ON LAN. Which is fairly easy. Of course the PC/NIC Card has to be capable of it and it has to be enabled.
    DEFINE_FUNCTION fnWoL(CHAR cMac[]) 
    {
        IP_CLIENT_OPEN(dvWoL.PORT,cWoL_Address,nWoL_Port,IP_UDP)
        SEND_STRING dvWoL,"$FF,$FF,$FF,$FF,$FF,$FF,cMac,cMac,cMac,cMac,cMac,cMac,cMac,cMac,cMac,cMac,cMac,cMac,cMac,cMac,cMac,cMac"
       IP_CLIENT_CLOSE(dvWoL.Port)	
    }
    
  • Options
    travistravis Posts: 180
    is there any way to programatically get the MAC address ?

    DEVICE_INFO on an IP connected device gives me the info for the master.
  • Options
    You could telnet to it and issue an ipconfig /all and parse that.

    But the amount of programming effort involved doesn't justify just hardcoding the mac or storing it in a file on the controller.

    Guess you could store them in a mySQL database, but again, loads of effort for not much gain in my opinion!
Sign In or Register to comment.