This recipe describes how to start and/or stop SQL Server services.
Check which SQL Services are installed in your machine. Go to Start | Run and type services.msc
. You should see a screen similar to this:
Let's look at the steps to toggle your SQL Server services states:
Open PowerShell ISE as administrator.
Add the following code:
$verbosepreference = "Continue" $services = @("SQLBrowser", "ReportServer") $hostName = "localhost" $services | ForEach-Object { $service = Get-Service -Name $_ if($service.Status -eq "Stopped") { Write-Verbose "Starting $($service.Name) ...." Start-Service -Name $service.Name } else { Write-Verbose "Stopping $($service.Name) ...." Stop-Service -Name $service.Name } } $verbosepreference = "SilentlyContinue"
Execute and confirm that the...