Ruby script that will restart a Windows server...

G

grooveska

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!
 
J

Jano Svitok

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
 
G

grooveska

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.
 
G

grooveska

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

Thanks!
 
R

Robert Klemme

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

Kind regards

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,310
Members
47,977
Latest member
MillaDowdy

Latest Threads

Top