Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 VBScript to stop SQL server?

Author  Topic 

Gopher
Yak Posting Veteran

83 Posts

Posted - 2006-04-19 : 08:36:57
Hi All

Does anyone have an example of a script that with stop SQL and the SQL agent and then start them up again?

Thanks

Gopher!

schuhtl
Posting Yak Master

102 Posts

Posted - 2006-04-19 : 10:04:31
Here are two sample scripts... one to stop and one to start

set WShell = CreateObject("WScript.Shell")
cmdStopMSSQL = "net stop MSSQLServer"
cmdStopAgent = "net stop SQLServerAgent"
WShell.Run "%comspec% /c " & cmdStopAgent
WShell.Run "%comspec% /c " & cmdStopMSSQL

set WShell = CreateObject("WScript.Shell")
cmdStartMSSQL = "net start MSSQLServer"
cmdStartAgent = "net start SQLServerAgent"
WShell.Run "%comspec% /c " & cmdStartMSSQL
WShell.Run "%comspec% /c " & cmdStartAgent
Go to Top of Page
   

- Advertisement -