How to ping and shutdown a remote computer?

2007-02-14 Thread joja15
I am working on a Python script to perform as a remote computer
manager. So far I have a WOL function working and I would like to add
the ability to show if a machine is on or off (I figured I would do so
by pinging the machine and seeing if I get a response). I would also
like to add the ability to remotely shutdown a computer from the
python script. Does anyone have a code snippet for pinging an IP, a
code snippet for shutting down a remote Windows XP machine, and a code
snippet for sending a HTTP request?

Here is my current setup:

- PC  running python script
- FreeNAS (media server running on FreeBSD. Can be shutdown from web
interface so I planned on just sending that same web button click from
the python script to shutdown the FreeNAS server)
- Windows XP machine with folder share (What packet is sent over the
network to remotely shutdown a Windows XP machine?)

My hope is to have a script then when you start it will list all your
remote computers/servers and show if they are currently on/off. Then
you can select a server and turn it off if it is on or turn it on if
it is off.

Thank you in advance for any help provided.

- John

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to ping and shutdown a remote computer?

2007-02-14 Thread joja15
On Feb 14, 10:09 am, Christophe <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] a écrit :
>
>
>
> > I am working on a Python script to perform as a remote computer
> > manager. So far I have a WOL function working and I would like to add
> > the ability to show if a machine is on or off (I figured I would do so
> > by pinging the machine and seeing if I get a response). I would also
> > like to add the ability to remotely shutdown a computer from the
> > python script. Does anyone have a code snippet for pinging an IP, a
> > code snippet for shutting down a remote Windows XP machine, and a code
> > snippet for sending a HTTP request?
>
> > Here is my current setup:
>
> > - PC  running python script
> > - FreeNAS (media server running on FreeBSD. Can be shutdown from web
> > interface so I planned on just sending that same web button click from
> > the python script to shutdown the FreeNAS server)
> > - Windows XP machine with folder share (What packet is sent over the
> > network to remotely shutdown a Windows XP machine?)
>
> import os
> os.system("shutdown -s -f")
> Try other switches if you want. Requires Windows XP at the minimum.

That is a good idea but I don't have Windows XP on the machine
performing the shutdown. I should have been more detailed. I said PC
but what it is is a Xbox running XBMC: http://www.xboxmediacenter.com

I should have been more detailed in that.

- John

-- 
http://mail.python.org/mailman/listinfo/python-list