Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Display SQL services information

By Ganesh Pittala,

By using the Windows Management Instrumentation command (WMIC) we can find the details.WMIC is probably one of the most powerful administrators tool and can be used for getting information and shutting down services, monitoring process, if you need to find the service Account information for SQL Server services on all SQL Servers remotely? Try this below steps to get the results in one single line command:

Please find the below process to get the service account details for the given list of servers.

Step1. Copy the below code into notepad and save it as SQL.bat in C:> Drive
Step2. Run command prompt as C:\SQL.bat Houston1 Houston2 Houston3 >C:\Output.xls
Note: Please give the machine name is physical Box name Houston1 Houston2 Houston3.............your list of physical server names

Code
@echo off
@if "%1"=="?" goto Syntax
@if "%1"=="" goto Local
rem ********************************************************
rem Description: Display SQL servicess information
rem **********************************************************

:Loop
if {%1}=={} goto :EXIT
@echo ************************
@echo Machine: %1
@echo ************************
wmic /node:%1 service WHERE "(Name Like 'MSSQL%%' OR Name Like 'SQLAgent%%' OR Name Like 'SQLServer%%' OR Name = 'MSDTC') And Name <> 'MSSQLServerADHelper'" get DisplayName, Name, startname
SHIFT /1
goto Loop

:Local
@echo ******************************************
@echo *** Machine: %COMPUTERNAME%
@echo ************************************************
wmic service WHERE "(Name Like 'MSSQL%%' OR Name Like 'SQLAgent%%' OR Name Like 'SQLServer%%' OR Name = 'MSDTC') And Name <> 'MSSQLServerADHelper'" get DisplayName, Name, startname
goto :EXIT

:Syntax
@echo Syntax: sql [Houston1 Houston2 Houston3 ....]
goto :EXIT

:EXIT

Total article views: 1273 | Views in the last 30 days: 7
 
Related Articles
BLOG

SQL Server – How to identify service pack installed

Identifying current service pack installed for SQL Server can be difficult if you don’t know which c...

FORUM

Uninstall SQL SERVER 2005 from command prompt

Uninstall SQL SERVER 2005 from command prompt

FORUM

SQL Server Service not starting

SQL Server Service not starting

BLOG

Stop'n'Start SQL Services via command prompt (cmd)

Using the command prompt for stopping and starting services is a very nice possibility and very fast...

FORUM

Sql Server Integration Services.

Sql server Integration services.

Tags
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones