Verify if local administrator account is being used to start services on multiple servers


Can someone help me with this search ..
I need to search a list of servers and output if any of those servers have any services running with these two local accounts.
Local accounts = X123 and Administrator

The output file should tell me the server name,Name,StartName

or if easier .. the output can show me all the local accounts being used .. I can then sort the output by just those accounts
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris HInfrastructure ManagerCommented:
I use this command locally:

wmic service get Caption,StartName

It will return results as such:
Portable Device Enumerator Service                      LocalSystem

Windows Presentation Foundation Font Cache      NT AUTHORITY\LocalServic
Windows Update                                          LocalSystem

Open in new window

MilesLoganAuthor Commented:
Yeah , I can get the basics with this search but not multiple servers or just to check for those two local accounts ..

Get-WMIObject Win32_Service -ComputerName server123 | Where-Object{$_.StartName -eq '.\x123'} | Sort-Object -Property StartName | Format-Table Name, StartName
Chris HInfrastructure ManagerCommented:
wmic /node:%servername% service get Caption,StartName | find ".\x123"

Open in new window

This worked for me
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Chris HInfrastructure ManagerCommented:
wmic /node:d service get Caption,StartName | find "local"


Application Experience                                  localSystem                  
Wired AutoConfig                                        localSystem                  
Extensible Authentication Protocol                      localSystem                  
Health Key and Certificate Management                   localSystem                  
Remote Access Auto Connection Manager                   localSystem                  
Remote Access Connection Manager                        localSystem                  
Routing and Remote Access                               localSystem                  
Terminal Services Configuration                         localSystem                  
Windows Modules Installer                               localSystem                  
Terminal Services UserMode Port Redirector              localSystem                  
Desktop Window Manager Session Manager                  localSystem                  
Block Level Backup Engine Service                       localSystem                  
Problem Reports and Solutions Control Panel Support     localSystem                  
Windows Error Reporting Service                         localSystem                  
Windows Management Instrumentation                      localSystem                  
WMI Performance Adapter                                 localSystem

d being the name of my remote server
Chris HInfrastructure ManagerCommented:
Batch file to do what you want:

@echo off
:: clear data file
echo %date% %time% > file.txt
for %%x in (
       ) do (
         echo ###SERVERNAME -- %%x -->> file.txt
	 wmic /node:%%x service get Caption,StartName | find "local" >> file.txt

Open in new window

change the names from server 1, server 2 to your servers.  Add more if you'd like, just trim trailing spaces.  

Also, change the "local " to whatever user you're looking for

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MilesLoganAuthor Commented:
Thanks !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.