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.
Author |
Topic |
Gopher
Yak Posting Veteran
83 Posts |
Posted - 2006-04-19 : 08:36:57
|
Hi AllDoes anyone have an example of a script that with stop SQL and the SQL agent and then start them up again?ThanksGopher! |
|
schuhtl
Posting Yak Master
102 Posts |
Posted - 2006-04-19 : 10:04:31
|
Here are two sample scripts... one to stop and one to startset WShell = CreateObject("WScript.Shell") cmdStopMSSQL = "net stop MSSQLServer" cmdStopAgent = "net stop SQLServerAgent" WShell.Run "%comspec% /c " & cmdStopAgentWShell.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 |
 |
|
|
|
|