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

Hi EE

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
LVL 2
MilesLoganAsked:
Who is Participating?
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 4.0.0.0      NT AUTHORITY\LocalServic
e
Windows Update                                          LocalSystem

Open in new window

0
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
0
Chris HInfrastructure ManagerCommented:
wmic /node:%servername% service get Caption,StartName | find ".\x123"

Open in new window


This worked for me
0
ON-DEMAND: 10 Easy Ways to Lose a Password

Learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees in this on-demand webinar. We cover the importance of multi-factor authentication and how these solutions can better protect your business!

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

yielded:

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
0
Chris HInfrastructure ManagerCommented:
Batch file to do what you want:

@echo off
:: clear data file
echo %date% %time% > file.txt
for %%x in (
        server1
	server2
       ) 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
0

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 !
0
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
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.