Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Restarting a windows service using VBScript

, 2 Mar 2010
Rate this:
Please Sign up or sign in to vote.
Set oshell = createobject("Wscript.Shell") oshell.run"cmd.exe" wscript.sleep 500 oshell.sendkeys "net stop ""Your service name here"""+("{Enter}") wscript.sleep 5000 oshell.sendkeys "net start ""Your service name here"""+("{Enter}") wscript.sleep 5000 ...
 Set oshell = createobject("Wscript.Shell")
    oshell.run"cmd.exe"
    wscript.sleep 500
    oshell.sendkeys "net stop ""Your service name here"""+("{Enter}")
    wscript.sleep 5000
    oshell.sendkeys "net start ""Your service name here"""+("{Enter}")
    wscript.sleep 5000
    oshell.sendkeys "exit"+("{Enter}")
 
    set oshell = nothing
 
    WScript.Quit

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Rudy du Plooy
Team Leader
South Africa South Africa
Studied Engineering Computer Science at Techinikon Pretoria, South Africa.
Have been a Software Developer for 9 year using different technologies nl. Assembler 8, 16, 32 and 64 bit, Delphi 6 and 7, C++, Java, ASP. For last 7 year I focused on C# and ASP.net also have extensive SQL 2000, 2005 and 2008 experience. I am currently employed as a Software Development Team leader and Software Architect at a vehicle tracking company in South Africa.

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 3 Mar 2010
Article Copyright 2010 by Rudy du Plooy
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid