Security Power

Chapter 16 of 18

Chapter 16: PowerShell for Ethical Hackers

Welcome to a chapter about seeing a computer the way a defender sees it. You will learn to read what runs, what listens, who can sign in, and what the logs record. This work is for your OWN lab only, with permission, for understanding and defense. You will not learn to attack real systems here. You will learn to spot problems early, ask good questions, and make a system safer. Take it one small check at a time, and you will build a calm, careful habit that serves you well.

4 lessons 3 learning objectives 4 related commands

Topics at a glance: The Safe Enumeration Mindset, Reading Your Own System and Services, Reading Network Listeners, Domain Objects, and Shares, Reading Logs and Hardening Basics.

Where this chapter fits

This chapter comes after Chapter 15: Small Commands, Big Everyday Wins in the journey, so ideas from that chapter will feel familiar here.

After this chapter comes Chapter 17: PowerShell Security and Hardening.

Learning objectives

By the end of this chapter, you will be able to:

  • Enumerate your own lab system, services, users, network listeners, shares, and logs with read only PowerShell commands
  • Spot signs that deserve investigation, such as unknown services, unexpected accounts, open shares, and failed logons
  • Explain the defender follow up for each finding, including disabling what is not needed, removing stale accounts, and applying least privilege

Lessons in this chapter

Work through the lessons in order. Each lesson page has explanations, examples, common mistakes, and a knowledge check.

  1. Lesson 1: The Safe Enumeration Mindset

    Enumeration means listing what exists on a system so you can understand it. You do it only in your own lab, with permission, and you write down what you find so a defender can act on it.

    3 things to learn in this lesson

  2. Lesson 2: 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.

    3 things to learn in this lesson

  3. Lesson 3: Reading Network Listeners, Domain Objects, and Shares

    Network and directory checks show what your lab computer offers to others and who exists in a lab domain. You will read listening ports, adapters, domain users and computers, and shares, and learn what a defender looks for.

    3 things to learn in this lesson

  4. Lesson 4: Reading Logs and Hardening Basics

    Windows logs record sign ins, service changes, and scheduled tasks. This lesson shows how to read those logs, spot signs worth investigating, and follow up with simple hardening steps.

    3 things to learn in this lesson

Related command references

These command pages are linked to lessons in this chapter. Each command page has its syntax, parameters, and examples.

  • Get-NetTCPConnection

    Lists TCP connections, including listening ports and the process that owns each one.

    From the lesson: Reading Network Listeners, Domain Objects, and Shares

  • Get-SmbShare

    Lists shared folders on the local computer.

    From the lesson: Reading Network Listeners, Domain Objects, and Shares

  • Get-WinEvent

    Reads events from a Windows event log.

    From the lesson: Reading Logs and Hardening Basics

  • Get-LocalGroupMember

    Lists members of a local group on one computer.

    From the lesson: Reading Your Own System and Services

Tip: read the lesson first, then use the command page as a quick reference.