http://qs321.pair.com?node_id=301276

RolandGunslinger has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to write a perl script that will exec a command to stop and then restart a service on a remote win32 server if that service is not functioning. I know how to determine if the service isn't functioning, but I don't know how to initiate an rpc call to that remote pc. What's the best way to do this with perl under win32? Thanks in advance. UPDATE: I was looking for a straight perl solution, I've played around with IPC::Msg but can't seem to get it to work on Win2000, don't know if I have something wrong or if it just isn't win32 compatible. Didn't know if there were any other "pure perl" options. The llama in me wants to do it straight perl if I can....

Replies are listed 'Best First'.
Re: best way to rpc on win32?
by monktim (Friar) on Oct 22, 2003 at 17:23 UTC
Re: best way to rpc on win32?
by sunadmn (Curate) on Oct 22, 2003 at 17:09 UTC
    I am not sure if this is exactly what you are looking for, as I am not a windows guy but I think this might help out RPC::ONC
Re: best way to rpc on win32?
by inman (Curate) on Oct 23, 2003 at 12:59 UTC
    You have a Llama in you? Did you eat it?

    But seriously... try Win32::Service which can be used to start, stop and get the status of a service running on another host. You will of course need to run your script logged in with the appropriate access rights on the remote host (probably member of the admin group). If you use the psservice route mentioned earlier then you can specify a username and password.

    inman

Re: best way to rpc on win32?
by calin (Deacon) on Oct 22, 2003 at 18:06 UTC
    Net::Telnet? I know Windows 2000 has a telnet server. Do it the UNIX way!

    Seriously, you shoud use a more specialised tool if you're concerned about security. See other people's posts, I don't do Windows.

      Well I'm a linux user by heart, but work requires I admin Windows boxes, along with VB client/server coding....sigh.... anyways, I use perl whenever I can to script stuff on my servers