Solved

Stop Service, Wait 5 Minutes, Then restart computer

Posted on 2007-11-15
5
933 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

832 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