In today’s .NET Web application development landscape, having up and running all the plethora of services needed for development could seriously affect your notebook performance. In my case, having up the services for SQL Server, MongoDB, IIS plus at least two browsers for testing accounts for approx. 7 GB of RAM and 30% of CPU constant load.
Even if I don’t stay in front of my notebook, the cooler is constantly spinning making noise in the room.
So I looked for alternatives to easily turn on/off these services that I need for development in order not to have this constant load all the time.
And PowerShell scripts seems to be a good way to achieve this. At the bottom of the page you can download two PowerShell script which are turning on and off the services which I mentioned above.
Just as an info, the lines of code for turning a service off in PowerShell are the following:
$sqlServiceName = "SQL Server (SQLEXPRESS)" Stop-Service $sqlServiceName $serviceAfter = Get-Service $sqlServiceName "$sqlServiceName is now " + $serviceAfter.status
And the lines for turning a service on are the following:
$sqlServiceName = "SQL Server (SQLEXPRESS)" Start-Service $sqlServiceName $serviceAfter = Get-Service $sqlServiceName "$sqlServiceName is now " + $serviceAfter.status
These scripts can turn on or off pretty fast all the services that I need for development.
Hope can find them useful as well.