You are here

PowerShell - Getting All Running SQL Services

Getting all SQL Server services running on a server using PowerShell:

Get-WmiObject -Class sqlservice -Namespace "ROOT\Microsoft\SqlServer\ComputerManagement11" | Select ServiceName

Additionally, this can be set to an array and worked with as such.

$services = Get-WmiObject -Class sqlservice -Namespace "ROOT\Microsoft\SqlServer\ComputerManagement11" | Select ServiceName

foreach($service in $services)
{
    $service.ServiceName
}

$services[0].ServiceName
>> MSSQLSERVER

$services[1].ServiceName
>> SQLBrowser

$services[2].ServiceName
>> SQLSERVERAGENT

Categories: 
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
2 + 7 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer