WSUS Deprecation: Your Next Move in Patch Management

This Wednesday | 12 PM EST / 11 AM CET

Action1 5 How-to Articles 5 How to Find All Service Accounts Used on PCs

How to Find All Service Accounts Used on PCs

September 29, 2018

By Peter Barnett

A lot of data breaches start with attacks on privileged service accounts. An important step in proactively locking the security of your corporate network is to find all service accounts.

This article explains how to list Exchange service accounts using Action1 to find service accounts in domain Windows server 2008 r2 or other operating systems and also shows how to list service accounts from the command line for organizations that are not able to utilize Action1 in their environments.

Manually:

1. Execute WMI Query in ROOT\CIMV2 Namespace:

– Launch WMI Explorer or any other tool which can run WMI queries.
– Run WMI query: SELECT * FROM Win32_Service

2. Open WMIC Command-line Interface:

– Press WIN+R
– Type “wmic”, press Enter
– In wmic command line tool type: /node:RemoteComputerName service

3. Run This Simple Windows Powershell Script:

– thru WMI object: Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Service -Computer RemoteComputerName

4. Use Following Code to Select Specific Columns:

– execute: Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Service -Computer RemoteComputerName | Select-Object DisplayName, Started, StartMode, StartName, PSComputerName

5. Sort the Results Using the Line Below:

– invoke command: Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Service -Computer RemoteComputerName | Select-Object DisplayName, Started, StartMode, StartName, PSComputerName | Sort-Object DisplayName

6. The Next Code Helps to Filter Results:

– use it: Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Service -Computer RemoteComputerName | Select-Object DisplayName, Started, StartMode, StartName, PSComputerName | Where-Object -FilterScript {$_.DisplayName -like “*SQL Server*”}

7. Save Results to CSV File:

– run: Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Service -Computer RemoteComputerName | Select-Object DisplayName, Started, StartMode, StartName, PSComputerName | Export-CSV “c:\file.csv” -Append -NoTypeInformation

8. The Next Step Is to Query Multiple Computers:

– computers from a text file: Get-Content -Path c:\computers.txt | ForEach-Object {Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Service -Computer $_}
– computers from AD domain: Get-ADComputer -Filter {OperatingSystem -Like ‘Windows 10*’} | ForEach-Object {Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Service -Computer $_.Name}

With Action1:

Step 1: Get Started with Action1 for Free 

Sign up for a free version of the Action1 solution and install Action1 agents to your remote endpoints to manage them remotely. Here is the detailed instruction on how to get started.

Step 2 Type Your Question in Plain English:

search service accounts

Step 3 Set Filters, If Necessary

How to Find All Exchange Service Accounts Used on PCs

Step 4 See Results from All Endpoints in Seconds:

Endpoint Name

mac.widgets.local
fred.widgets.local
ray.widgets.local

Display Name

SQL Server
MS Exchange
File Backup

Started

True
True
False

User Name

WIDGETSsql1
WIDGETSxch
WIDGETSb1

State

Running
Running
Stopped

See What You Can Do with Action1

 

Join our weekly LIVE demo “Patch Management That Just Works with Action1” to learn more

about Action1 features and use cases for your IT needs.

 

spiceworks logo
getapp logo review
software advice review
trustradius
g2 review
spiceworks logo

Related Posts