mquinn0908
Technical User
I have the following batch files that run before and after a backup job to start SQL services on both the local machine and remote one to do a flat backup. The batch file does stop/start the services correctly on the remote server but the services on the local machine never stop. Can anyone give me a clue as to why?
commands to stop services:
@echo off
echo.
echo.Stopping the MSSQLSERVER service...
echo.
NETSVC "SQLSERVERAGENT" \\server name /stop >nul
PING 192.168.20.5 -n 10 -w 1000 >NUL
NETSVC "MSSQLSERVER" \\servername /stop >nul
NET STOP "SQL Server (MSSQLSERVER)" >nul
NET STOP "SQL Server Agent (MSSQLSERVER)" >nul
commands to start services:
@echo off
echo.
echo.Starting the MSSQLSERVER service...
echo.
NETSVC "SQLSERVERAGENT" \\server name /start >nul
echo.
echo.
echo.
echo.
NETSVC "MSSQLSERVER" \\server name /start >nul
NET START "SQL Server (MSSQLSERVER)" >nul
NET START "SQL Server Agent (MSSQLSERVER)" >nul
Mandy
MCP/A+/Network+
commands to stop services:
@echo off
echo.
echo.Stopping the MSSQLSERVER service...
echo.
NETSVC "SQLSERVERAGENT" \\server name /stop >nul
PING 192.168.20.5 -n 10 -w 1000 >NUL
NETSVC "MSSQLSERVER" \\servername /stop >nul
NET STOP "SQL Server (MSSQLSERVER)" >nul
NET STOP "SQL Server Agent (MSSQLSERVER)" >nul
commands to start services:
@echo off
echo.
echo.Starting the MSSQLSERVER service...
echo.
NETSVC "SQLSERVERAGENT" \\server name /start >nul
echo.
echo.
echo.
echo.
NETSVC "MSSQLSERVER" \\server name /start >nul
NET START "SQL Server (MSSQLSERVER)" >nul
NET START "SQL Server Agent (MSSQLSERVER)" >nul
Mandy
MCP/A+/Network+