检查所有 SQL 服务的状态

检查所有 SQL 服务的状态

我想列出所有 SQL 服务,包括报告服务。

Wmic service where (PathName like '%Binn\%sql%') get caption, name, startmode, state, PathName, ProcessId

这个将提供除 SSRS 之外的所有内容。任何人都知道该怎么做。

答案1

您可以编辑wmic和过滤服务名称而不是路径。

Wmic service where (Name like '%sql%') get caption, name, startmode, state, PathName, ProcessId

或者在 PowerShell 中(我建议你使用此方法)

Get-Service *sql*

这将返回名称中包含 SQL 的所有服务。

您也可以从 cmd 使用它,如下所示:powershell "Get-Service *sql*"

示例输出:

PS C:\Windows\system32> get-service *sql*

Status   Name               DisplayName
------   ----               -----------
Running  MSOLAP$SDFSF       SQL Server Analysis Services (XXXXX...
Running  MSSQL$SDFSDFS      SQL Server (XXXXXXXXXX)
Running  MSSQL$SDFSDF       SQL Server (XXXXX)
Running  MSSQLFDLauncher... SQL Full-text Filter Daemon Launche...
Running  MSSQLLaunchpad$... SQL Server Launchpad (XXXX)
Running  ReportServer$BB... SQL Server Reporting Services (XXXX...
Stopped  SQL Server Dist... SQL Server Distributed Replay Client
Stopped  SQL Server Dist... SQL Server Distributed Replay Contr...
Stopped  SQLAgent$xxxxxx... SQL Server-Agent (xxxx1)
Stopped  SQLAgent$xxxxx     SQL Server Agent (xxxxx)
Running  SQLBrowser         SQL Server Browser
Running  SQLTELEMETRY$BB... SQL Server CEIP service (xxxx)
Running  SQLTELEMETRY$xxxxx SQL Server CEIP service (xxxxx)
Running  SQLWriter          SQL Server VSS Writer
Running  SSASTELEMETRY$B... SQL Server Analysis Services CEIP (...

相关内容