?
Solved

Stop Service, Wait 5 Minutes, Then restart computer

Posted on 2007-11-15
5
Medium Priority
?
940 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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