Skip to content
Tutorials Center
My learning

Topics

Lesson 38 of 38 ยท Projects and Practice

Practice: Active Directory Scenarios and an Audit Script

Test your skills with realistic Active Directory scenarios on Group Policy, Kerberos, LDAP security and recovery, plus a runnable stale-account audit that turns sample data into a report.

You now know how Group Policy is processed, how Kerberos issues tickets, how to secure LDAP traffic, how to script administration and how to recover from mistakes. This final lesson ties it together. First come ten troubleshooting scenarios: read each, decide what you would check, and then compare with the answer. Then you build an audit script that finds stale and risky accounts from sample data.

The scenarios use real Windows tools in words only, because no domain runs on this site. The audit is a Python stand-in on invented data; adapt the logic to Get-ADUser output when you use it at work (PowerShell lesson).

Ten scenarios

Try to answer each one before reading the hint. Links go to the lesson with the theory.

  1. A new GPO links to the Sales OU but users never get the drive map. gpresult /r lists it under "not applied: Denied (Security)". The admin had removed Authenticated Users from filtering and added only the Sales-Users group. Hint: computers can no longer read the GPO. Add Read for Authenticated Users or Domain Computers (filtering).

  2. A security baseline keeps being overridden on lab machines. The lab OU has Block Inheritance set. Hint: Enforced links ignore blocking; mark the baseline link Enforced (precedence).

  3. A GPO shows version 12 in AD and 11 in SYSVOL on one DC. Some clients get old settings. Hint: DFSR is behind; check the DFS Replication log and dfsrdiag, then force replication (troubleshooting).

  4. Users in the Berlin branch cannot open a file share, errors say "The target principal name is incorrect". The share is reached through a DNS alias files that points to fs01. Hint: no SPN for the alias; register cifs/files.example.com on fs01$ or set the DisableStrictNameChecking and BackConnectionHostNames options as appropriate, after checking setspn -X (SPNs).

  5. A virtual machine restored from a snapshot cannot authenticate to anyone. Error: clock skew; then, after fixing time, "trust relationship between this workstation and the domain failed". Hint: correct the time, then reset the machine account password or rejoin: Reset-ComputerMachinePassword (errors).

  6. Event 2889 floods the DC log after you enabled LDAP interface diagnostics. Fourteen applications are listed. Hint: inventory each, move simple binds to LDAPS or StartTLS, then enforce signing and channel binding (LDAPS).

  7. An administrator deletes the OU "Finance" by mistake and everyone in it vanishes. The Recycle Bin was enabled last year. Hint: restore the OU first (Restore-ADObject), then its children (recovery).

  8. A password reset is accepted on one DC but the user still cannot sign in at a branch. The branch DC reports a long replication delay. Hint: check site links and schedules; check that the subnet maps to the right site; use repadmin /replsummary (replication). Urgent password changes are forwarded to the PDC emulator.

  9. A service ticket request spike shows one account requesting 60 service tickets with RC4. Hint: Kerberoasting; inspect the account, rotate weak service account passwords, move services to gMSAs and AES (hardening).

  10. A contractor group must have a 16-character minimum password, but the domain policy says 10. Hint: create a fine-grained PSO linked to a global security group (password policies).

Python Scenario flash cards

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Build an audit script

Auditors and security teams ask the same questions every year: who has not signed in for months, who never changes their password, who is privileged, and who has risky delegation or encryption settings. The script below takes a list of account records (what Get-ADUser -Properties * would give you) and creates a report. The data is invented.

The userAccountControl flags used are 2 (disabled), 65536 (password never expires), 4194304 (do not require Kerberos pre-authentication, 4,194,304) and 524288 (trusted for delegation).

Python Stale and risky account audit

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The script gives you a sorted worklist. In real use you would feed it with a PowerShell export (Export-Csv), run it on a schedule, and track the findings over time. Notice how many of the lessons in this chapter show up in a handful of flags.

Next steps

  • Build a lab: two domain controllers and a client in a hypervisor, using evaluation media, and rehearse promoting, joining, restoring and forest recovery.
  • Learn Microsoft Entra ID and hybrid identity (Entra Connect, password hash sync, seamless single sign-on) to extend what you know to the cloud.
  • Learn Active Directory Certificate Services and its security issues, and AD FS or OIDC for federation.
  • Study attack and defence tooling such as BloodHound, PingCastle and Microsoft Defender for Identity to see your domain as an attacker does.
  • Practice LDAP outside Windows: OpenLDAP, 389 Directory Server and FreeIPA use the same protocol with different schema and tools.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A user in the lab OU does not receive the domain baseline GPO and Block Inheritance is on. What is the cleanest fix?

    Enforced links cannot be blocked.
  2. 2. An account has userAccountControl 66048. Which flags are set?

    66048 is 512 + 65536.
  3. 3. Which finding is the highest priority in the audit?

    That account is a prime Kerberoasting target with a long-lived password.
  4. 4. Which tool is the first thing to run on a client that does not get policy?

    Refresh policy, then read what the client actually applied and why GPOs were filtered.

Summary

  • Troubleshooting is a method: reproduce, check scope, names, time, replication and logs, then fix the root cause.
  • Many scenarios reduce to a handful of causes: filtering permissions, DNS and SPNs, time, replication lag and unsafe binds.
  • A short audit script turns account flags into a prioritised worklist.
  • Keep practising in a lab and extend your skills toward hybrid identity, certificates and attack-aware defence.

Next: Return to the LDAP and Active Directory track overview and revisit any chapter you want to strengthen.