Solved

Stop Service, Wait 5 Minutes, Then restart computer

Posted on 2007-11-15
5
932 Views
Last Modified: 2010-04-21
I need a simple vbs script that

stops service  d3vme
wait 5 minutes (make sure service stops)
reboot server
0
Comment
Question by:LeviDaily
  • 2
  • 2
5 Comments
 
LVL 29

Expert Comment

by:Badotz
ID: 20294139
I don't believe there is a sleep command in VBScript, but I could be mistaken...
0
 
LVL 2

Author Comment

by:LeviDaily
ID: 20294189
ok...Would the best be to use a batch command? If so, do you have one?
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 20294203
Hi, you can use this:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "net stop d3vme"
WScript.Sleep 300000 ' wait five minutes
objShell.Run "shutdown -r -t 0"

Or this to just have the Shutdown timeout to five minutes
Set objShell = CreateObject("WScript.Shell")
objShell.Run "net stop d3vme"
objShell.Run "shutdown -r -t 300"


Regards,

Rob.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 20294215
Oh, and you can hide those command prompts:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "net stop d3vme", 0, True
objShell.Run "shutdown -r -t 300", 0, False

The second parameter of zero means run it hidden, the third parameter waits for the comand to finish before processing the next one.

Regards,

Rob.
0
 
LVL 2

Author Closing Comment

by:LeviDaily
ID: 31409471
Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now