SQL Server Scripts: Restart the SQL Service through a batch file
My SQL instance also has a tendency to consume all the memory on the VM (even 16GB is not enough), so I keep another script on the desktop to restart the SQL. My first problem was finding the name of the service. A simple 'net start' command in the command prompt listed all the services. The following script solved my problem: ECHO "Stopping SQL Server" net stop "MSSQLSERVER" /Y ECHO "Starting SQL Server" net start "MSSQLSERVER" @PAUSE I have found this to be very helpful when the machine is struggling and opening up services.msc seems to take an eternity. I have rekindled my love of batch files - they certainly solve the problem quickly and efficiently.