Is it possible to invoke a script (*.vbs) from an SQL startup script
-
Wednesday, February 20, 2013 7:57 PM
I need to know if it is possible that when we start SQL some executable runs as well to start application services after SQL starts.The intention is to automate the process that when SQL starts , some application services starts as well (this is done thru a script with a vbs extension)..Please advise.. Thanks
All Replies
-
Wednesday, February 20, 2013 10:49 PM
You can run .VBS file as below from sql server.
Exec xp_cmdshell 'cscript C:\Filename.vbs'
You can write your script using Exec xp_cmdshell 'cscript C:\Filename.vbs' & create one store procedure.
Mark that store procedure as startup procedure. Now SQL server will execute this store procedure each time on start up.
Regards,
Rohit Garg
(My Blog)
This posting is provided with no warranties and confers no rights.
Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread.- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Sunday, February 24, 2013 3:17 AM
- Marked As Answer by Allen Li - MSFTModerator Wednesday, February 27, 2013 12:54 AM
-
Thursday, February 21, 2013 12:33 AM
Thanks much Rohit..will try that!
-
Thursday, February 21, 2013 7:32 PM
Make sure that the script has no GUI elements (no windows, i.e., a pure console script) and requires no user input.- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Sunday, February 24, 2013 3:19 AM
- Marked As Answer by Allen Li - MSFTModerator Wednesday, February 27, 2013 12:54 AM
-
Monday, February 25, 2013 10:58 PMModeratorYou could create a sqlagent job with a schedule that "Starts automatically when SQL Agent starts"
Thanks, Sethu Srinivasan [MSFT] SQL Server http://blogs.msdn.com/sqlagent -------------------------------------------------------------------------------- This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

