Security Power Level: Advanced Chapter 16: PowerShell for Ethical Hackers

Reading Your Own System and Services

You can read a lot about your own computer with simple commands. This lesson shows how to list processes, services, system facts, local users, and group members, and how to spot what looks out of place.

Lesson 2 of 4 in Chapter 16: PowerShell for Ethical Hackers. Previous step in this path: The Safe Enumeration Mindset. 3 learning objectives, 5 examples, and a knowledge check.

Start: what you will learn

You can read a lot about your own computer with simple commands. This lesson shows how to list processes, services, system facts, local users, and group members, and how to spot what looks out of place.

Learning objectives

  • List processes, services, and basic system facts on your own lab computer
  • List local users and the members of local groups
  • Spot signs that deserve investigation, such as unknown services and unexpected accounts

Concept in simple words

What it is: System and service enumeration means listing what runs on your own computer and who can use it. This is for your OWN lab only, with permission, for understanding and defense. You use read only commands, which show information without changing settings, so you can learn without breaking anything.

Why it works

Why it exists: A computer hides a lot of detail behind its normal screen. A process is a running program. A service is a background program that Windows runs, often without a window. A local user is an account on that one computer. When you list them, you see the real state of the machine, not just the apps on the desktop. That real state is what a defender must review.

What problem it solves: The desktop shows only what you opened. It does not show background services, old accounts, or group memberships. An account can exist even if no one has signed in with it for months. A service can run even if it has no window. Listing solves the hidden state problem by bringing those facts into one readable place.

What PowerShell is doing behind the command: Each Get command returns objects with properties. Get-Process returns process objects. Get-Service returns service objects. Get-LocalUser returns local user objects. When you pipe those objects to Select-Object, you choose which properties to display. When you pipe to Where-Object, you test each object against a rule and keep only the matches. Nothing is changed. PowerShell is only asking, filtering, and displaying.

Processes in depth: A process is one running instance of a program. The same program can have more than one process, and each one has its own Id. The Id is unique while that instance runs, but Id numbers are reused after a process ends, so an Id alone is not a permanent identity. Name tells you the program, Id tells you which instance, and Path, when shown, tells you where the program file lives. An unknown name is a question, not a verdict. Check the Path and the software you installed before you judge it.

Services in depth: A service has a Name, which is short and used by commands, and a DisplayName, which is friendly and shown in tools. Status tells you whether it is Running, Stopped, or Paused. StartType tells you how it starts, such as Automatic, Manual, or Disabled. A service set to Automatic starts with Windows. A service set to Manual starts only when needed. A running service you did not expect is worth a note, and so is a service that should run but is stopped, because that can mean a lab change or a fault.

System facts in depth: Get-ComputerInfo returns a large bundle of facts about hardware, BIOS, and Windows. For a defender, the useful facts are simple: which Windows product and version, which build, how much memory, and how many processors. Use -Property to ask for only those facts, so the result stays short. A long, unfiltered dump is not more careful. It is just harder to read, and harder to compare next week.

Local users in depth: Get-LocalUser lists accounts on this one computer only, not accounts in a domain. Each user object has a Name, an Enabled flag, and a LastLogon time. Enabled True means the account can sign in. Enabled False means it cannot sign in until it is enabled again. LastLogon can be empty for an account that has never signed in. An enabled account with no recent logon is not automatically bad. It may be a test account you created and forgot. It is still worth a note, because forgotten accounts are easy to overlook.

Groups and membership in depth: A local group is a bundle of permissions. A user in the Administrators group can manage that computer. A user in the Users group has normal access. Get-LocalGroupMember with -Group and a group name lists who belongs to that group. Membership matters more than the account name alone, because the same account is far more powerful in Administrators than in Users. Always check the powerful groups first, and write down both the member name and the ObjectClass, which tells you whether the member is a user or a group.

Think of it like this

Think of it like this: Think of it like opening the staff list and the duty roster for a small building. The roster shows who is on duty, which doors are staffed, and which roles each person holds. If a name you do not know appears on the roster, you ask about it. You do not accuse anyone, you just check. A roster is useful only when it is complete, so read the whole list, not just the first page.

How it works, step by step

How it works, step by step: First, list running processes with Get-Process, and look for names you do not recognise. Second, list services with Get-Service, and note any service that runs when you did not expect it. Third, read basic system facts with Get-ComputerInfo, such as the Windows version. Fourth, list local users with Get-LocalUser, and list group members with Get-LocalGroupMember, and check who belongs to powerful groups such as Administrators.

A careful order for one review: Start broad, then narrow. First, get the full service list and the full user list, so you know the size of the job. Then filter to running services, enabled users, and Administrators members. Then pick one odd item at a time and ask where it came from. If you narrow first and never see the full list, you cannot tell whether your filter hid something important.

Why it works

Why you run these as separate commands: Each Get command returns a different kind of object. Processes, services, system facts, users, and group members do not share the same shape, so piping one kind into the next Get command does not combine them into one useful list. Run each command on its own line, save each result under its own heading, and compare them as separate lists. A semicolon between commands on one line only separates them. It does not merge their results.

Let us walk through an example: Suppose you run Get-LocalUser on your lab computer and you see an account you did not create. You write down its name, whether it is enabled, and the date you saw it. Then you check whether it came with a program you installed in the lab, and you flag it for a defender to review. You do not delete the account on a system you do not manage, and you do not use it to sign in as someone else. The note is the action. The defender decides the fix.

A second walkthrough, a service and a group together: Suppose a new service appears, and the same week a new member appears in Administrators. Either fact alone might be normal. Together, they deserve a stronger note, because a service plus a powerful account is a bigger change than either alone. Write both facts in one note, with both dates, so the defender sees the pattern, not two separate puzzles.

What normal looks like, and what does not: Normal is a list you can explain, line by line, from software you installed and accounts you created. Not normal, in the sense of worth a note, is a name you cannot explain, an enabled account with no owner, a member of Administrators you did not add, or a service that runs at boot without a clear purpose. Worth a note does not mean proven bad. It means check it before you move on.

When to use it

When to use it, and when not to: Use these commands on your own lab computer, or on a lab computer you have clear permission to audit. Do not use them to list users or services on another person computer, a shared computer you do not manage, or a network you do not own, even if the command itself only reads information. Reading without permission is still out of scope.

Scope and safety, stated plainly: This lesson is for your own lab only, with permission, for defense and understanding. It does not teach how to use another account, how to raise your access, how to take or guess a password, or how to move to another machine. If you find an unexpected account, you record it and flag it. You do not sign in with it, and you do not test what it can do.

Edge cases to know: Some processes show no Path, often because they are protected system processes, and that alone is not a finding. Some service names look strange but belong to normal Windows parts. Some accounts are built in, such as the built in Administrator and Guest accounts, and their presence alone is not a surprise. Learn your baseline first, so built in items stop looking strange, and true changes stand out.

How to keep notes that compare well: Use the same commands, in the same order, every time. Save each list with the date in the file name or heading. When a list changes, write what changed, not just the new list. A change note that says one service added, named X, on this date, is far more useful than two long lists with no comment.

Worked examples

Read each example in order. Each one explains its parts, then shows what to look for in the output.

Syntax

Syntax
Get-Process; Get-Service; Get-ComputerInfo; Get-LocalUser; Get-LocalGroupMember -Group 'Administrators'

Example 1

Walkthrough: Get-Service lists services as objects. Where-Object tests each object, and keeps only rows where Status equals Running, because a running service is the one doing work right now. Select-Object shows Name, which is the short service name, DisplayName, which is the friendly name, and Status. What to look for: familiar Windows services, and any running service whose friendly name you cannot connect to software you installed. What changes if you change one part: if you change Running to Stopped, you see present but idle services. If you add StartType to Select-Object, you also learn whether each service starts on its own at boot, which helps you judge whether a running service was started by Windows or by something else.

Example 1
Get-Service | Where-Object { $_.Status -eq 'Running' } | Select-Object Name, DisplayName, Status

Illustrative output: Name DisplayName Status ---- ----------- ------ Spooler Print Spooler Running

Example 2

Walkthrough: Get-LocalUser lists accounts on this one computer. Select-Object shows Name, Enabled, which tells you whether the account can sign in, and LastLogon, which tells you when it was last used. An enabled account with no recent logon still deserves a note, not a guess. What to look for: every name you can explain, plus any name you cannot, and any enabled account you thought was disabled. What changes if you change one part: if you add Where-Object { $_.Enabled -eq $true } before Select-Object, you see only accounts that can sign in, which is a good focused check, but you lose sight of disabled accounts, so run the full list first for your baseline.

Example 2
Get-LocalUser | Select-Object Name, Enabled, LastLogon

Illustrative output: Name Enabled LastLogon ---- ------- --------- LabUser True 11/3/2026 10:00:00 AM

Example 3

Walkthrough: Get-LocalGroupMember with -Group Administrators asks for the members of that one powerful group. The group name is in quotes because it is a single value with no spaces, and quotes keep it clear. Select-Object shows Name and ObjectClass. ObjectClass tells you whether the member is a User or a Group, which matters because a whole group inside Administrators gives power to every member of that group. What to look for: only members you expect, and no unknown user or nested group. What changes if you change one part: if you change Administrators to Users, you see normal users, which is a different, much larger list. If you remove Select-Object, you also see the SID, which is a long unique id for the member, useful when two members have similar names.

Example 3
Get-LocalGroupMember -Group 'Administrators' | Select-Object Name, ObjectClass

Illustrative output: Name ObjectClass ---- ----------- LABPC\LabUser User LABPC\Administrator User

Example 4

Walkthrough: Get-Process lists processes. Sort-Object WorkingSet -Descending reorders them so the largest memory use comes first. WorkingSet is the memory currently in use by the process. Select-Object shows Name, Id, and WorkingSet, and -First 5 keeps only the top five. What to look for: a familiar browser or editor at the top, or an unknown program using far more memory than the rest. What changes if you change one part: if you sort by CPU instead, you rank by processor time, which answers a different slow machine question. If you remove -First 5, you get the full memory ranking, which is better for a baseline but harder to skim.

Example 4
Get-Process | Sort-Object WorkingSet -Descending | Select-Object Name, Id, WorkingSet -First 5

Illustrative output: Name Id WorkingSet ---- -- ---------- pwsh 1234 125829120 notepad 2345 15728640

Example 5

Walkthrough: Get-ComputerInfo returns a large bundle of system facts. The -Property parameter asks for only three of them. WindowsProductName is the Windows product name, OsBuildNumber is the build number, which is more precise than the friendly version name, and CsTotalPhysicalMemory is total physical memory in bytes. What to look for: a product and build that match your lab machine, and a memory total that matches the hardware you set up. What changes if you change one part: if you add CsNumberOfLogicalProcessors, you also learn how many logical processors the machine reports. If you use -Property with a misspelled name, that column comes back empty, so copy property names carefully from a result you have already seen.

Example 5
Get-ComputerInfo -Property WindowsProductName, OsBuildNumber, CsTotalPhysicalMemory

Illustrative output: WindowsProductName : Windows 11 Pro OsBuildNumber : 26100 CsTotalPhysicalMemory : 8589934592

Nothing on this page executes PowerShell code. The outputs above are illustrative only.

Common mistakes and troubleshooting

Read these before you try the examples, so you can spot the same problems in your own work.

  • Running these checks on a system you do not own, such as another person computer or a shared computer, instead of staying in your own lab.
  • Treating every unknown name as proof of an attack, instead of writing it down and checking whether it came with normal software you installed.
  • Reading only the first few rows and stopping, so an unexpected account or service further down the list is never seen.
  • Piping different kinds of objects together, such as processes into Get-Service, and expecting one combined list, when each Get command needs to run on its own.
  • Checking only Administrators and ignoring other groups, so a powerful membership in a different group is never noticed.
  • Trusting LastLogon alone, when an account can be important even if it has never signed in, because Enabled True still means it could sign in.
  • Comparing a new list with a note from a different computer, which creates a false difference and wastes a defender time on a change that never happened.

Knowledge check

Knowledge check

You list local users in your lab and find an account you did not create. What is the best first step?

Pick one answer. Feedback appears right away, and you can try again.

Remember this and next step

Remember this: List first, compare with what you expect, and write down anything odd. Unknown services, unexpected accounts, and programs that should not run are not proof of an attack by themselves, but they are good reasons to investigate with care, in your own lab, and to flag the facts for the defender who manages the system.

Next step: Reading Network Listeners, Domain Objects, and Shares