Friends are your lifeline that keep your life interesting. I have various friends’ circles that range from family, acquaintances, work and the most exciting circle is the technical circles. Most of the times the tech circles is what fuels most of the post that lands up here. I was talking to one of my friend and he gave a passing statement without much info. It was in my mind for a long time to research, but am I glad I figured out. I learned new way to find details about SQL Server startup account – using WMIC. I did some more research with this and sharing it with my blog readers.
What is WMIC? It stands for Windows Management Instrumentation Command. In simple words, WMIC is a utility which allows us to interact with WMI from a WMI-aware command-line shell. All WMI objects and their properties, including their methods, are accessible through the shell, which makes WMIC a super strong console.
WMIC has a parameter for Service application management. To get help we can use /? as shown below:
We can use where clause and get method to get details about services related to SQL Server. Here is the naming which is consistent since old days:
|SQL Component||Display Name||Service Name|
|SQL Server – Default Instance||SQL Server (MSSQLSERVER)||MSSQLServer|
|SQL Server – Named Instance||SQL Server (NameOfInstance)||MSSQL$NameOfInstance|
|SQL Server Agent – Default Instance||SQL Server Agent (MSSQLSERVER)||SQLSERVERAGENT|
|SQL Server Agent – Named Instance||SQL Server Agent (NameOfInstance)||SQLAgentNameOfInstance|
|SQL Server Browser||SQL Server Browser||SQLBrowser|
|SQL Server Full text – Default Instance||SQL Full-text Filter Daemon Launcher (MSSQLSERVER)||MSSQLFDLauncher|
|SQL Server Full text – Named Instance||SQL Full-text Filter Daemon Launcher (NameOfInstance)||MSSQLFDLauncher$SQL2014|
You can add more to list for Reporting Services, Analysis Services etc.
Here is the WMI query which can list services using like operator. If you can familiar with T-SQL then you would know that % is operator.
wmic service where “name Like ‘%MSSQL%’ or name like ‘%SQL%Agent%'” get Name , StartName
and here is the output
Did you find it interesting? Do let me know what you find in your environments? The learning will never stop here though.
Reference: Pinal Dave (https://blog.sqlauthority.com)