Pages

Friday, June 7, 2019

A Simple PowerShell Function to Get SQL Server Services on a Computer

This is a simple PowerShell function that gets all services related to SQL Server services on a computer with its status (running or stopped).


function Get-SQLServices { Get-Service | Select-Object Name, Status, DisplayName | Where-Object Name -like *sql* | Sort-Object Status -Descending | Format-Table -AutoSize }

Name Status DisplayName ---- ------ ----------- MSSQLServerOLAPService Running SQL Server Analysis Services (MSSQLSERVER) SQLWriter Running SQL Server VSS Writer SQLTELEMETRY Running SQL Server CEIP service (MSSQLSERVER) MSSQLFDLauncher Running SQL Full-text Filter Daemon Launcher (MSSQLSERVER) MSSQLSERVER Running SQL Server (MSSQLSERVER) SQLPBENGINE Stopped SQL Server PolyBase Engine (MSSQLSERVER) SQLSERVERAGENT Stopped SQL Server Agent (MSSQLSERVER) SQL Server Distributed Replay Controller Stopped SQL Server Distributed Replay Controller MSSQLLaunchpad Stopped SQL Server Launchpad (MSSQLSERVER) SQL Server Distributed Replay Client Stopped SQL Server Distributed Replay Client SQLPBDMS Stopped SQL Server PolyBase Data Movement (MSSQLSERVER) SQLBrowser Stopped SQL Server Browser

No comments:

Post a Comment