Ruby script that will restart a Windows server

I have been researching on how to write a script that will restart a
Windows 2003 server. I haven’t had much luck yet and was wondering if
anyone else had done anything similar, and how you went about creating
that script.

Thanks!

On 6/26/07, grooveska [email protected] wrote:

I have been researching on how to write a script that will restart a
Windows 2003 server. I haven’t had much luck yet and was wondering if
anyone else had done anything similar, and how you went about creating
that script.

Hi,

it depends whether you want a local restart or a remote one.

these can be useful:
http://www.aumha.org/win5/a/shutcut.php (use `` to call)
http://msdn2.microsoft.com/en-us/library/aa376868.aspx (use Win32API to
call it)
http://groups.google.co.nz/group/ruby-talk-google/browse_thread/thread/a0f7ec27d255ed63

Maybe WMI has something as well… (use Win32OLE to access WMI)

finally have a look at win32utils project at rubyforge.org - it may
already wrap the function for you. (if not, and you succeed with
wrapping, you may consider posting a patch for others to enjoy)

Jano

You could just do shutdown /r

On 6/26/07, grooveska [email protected] wrote:

already wrap the function for you. (if not, and you succeed with
wrapping, you may consider posting a patch for others to enjoy)

Jano


“Hey brother christian with your high and mighty errand, Your actions
speak
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

Thanks for the reply Jano.

I am just looking to create a ruby script that will do a local
restart. Just write the ruby script, create a task in task scheduler
and be done with it. I’ll check out the links you’ve posted below.

I’ll take a look at the win32utils. I had forgotten about that
project.

cygwin also has a package with a reboot / restart command. And you can
even schedule cron jobs with cygwin.

Kind regards

robert

I just found that. Using that is probably much simpler than trying to
access the WMI and all that stuff.

Thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs