Before you harden anything, find out what you have. These read-only commands show the password policy, who holds admin rights, risky account settings and how each domain controller is set up. Nothing is changed.
What improves
You know where the domain stands before you change anything.
Why it matters
Hardening without a baseline wastes effort and can miss the biggest gaps.
How you do it
Run read-only commands for policies, admin groups, risky accounts and DC settings.
Domain settings
CON-DC-01
$dom = Get-ADDomain Get-ADForest | Format-List Name, ForestMode Get-ADOptionalFeature -Filter * | Format-Table Name, EnabledScopes -AutoSize "Machine account quota: " + (Get-ADObject $dom.DistinguishedName -Properties 'ms-DS-MachineAccountQuota').'ms-DS-MachineAccountQuota'
Password and lockout policy
CON-DC-01
Get-ADDefaultDomainPasswordPolicy | Format-List MinPasswordLength, PasswordHistoryCount, ComplexityEnabled, MaxPasswordAge, LockoutThreshold, LockoutDuration Get-ADFineGrainedPasswordPolicy -Filter * | Format-Table Name, Precedence, MinPasswordLength, LockoutThreshold -AutoSize
Who holds admin rights
CON-DC-01
foreach ($g in 'Domain Admins','Enterprise Admins','Schema Admins','Administrators','Account Operators','Backup Operators','Server Operators','Print Operators','DnsAdmins','Group Policy Creator Owners','Protected Users') {
$m = Get-ADGroupMember -Identity $g -Recursive -ErrorAction SilentlyContinue
"{0,-28} {1}" -f $g, (($m | ForEach-Object { $_.SamAccountName }) -join ', ')
}Risky account settings
Each list should be short or empty.
CON-DC-01
"Password never expires:"
Get-ADUser -Filter 'PasswordNeverExpires -eq $true -and Enabled -eq $true' | ForEach-Object { " " + $_.SamAccountName }
"Password not required:"
Get-ADUser -Filter 'PasswordNotRequired -eq $true' | ForEach-Object { " " + $_.SamAccountName }
"No Kerberos pre-authentication:"
Get-ADUser -Filter 'DoesNotRequirePreAuth -eq $true' | ForEach-Object { " " + $_.SamAccountName }
"Reversible encryption:"
Get-ADUser -Filter 'AllowReversiblePasswordEncryption -eq $true' | ForEach-Object { " " + $_.SamAccountName }
"User accounts with an SPN:"
Get-ADUser -Filter 'ServicePrincipalName -like "*"' | Where-Object SamAccountName -ne 'krbtgt' | ForEach-Object { " " + $_.SamAccountName }
"Computers trusted for unconstrained delegation (not DCs):"
Get-ADComputer -Filter 'TrustedForDelegation -eq $true' -Properties PrimaryGroupID | Where-Object { $_.PrimaryGroupID -notin 516,521 } | ForEach-Object { " " + $_.Name }Settings on each domain controller
CON-DC-01
Invoke-Command -ComputerName (Get-ADDomainController -Filter *).HostName -ScriptBlock {
$lsa = Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa'
$ntds = Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters'
$smb = Get-SmbServerConfiguration
$spl = Get-Service Spooler
[pscustomobject]@{
LastUpdate = (Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 1).InstalledOn
SMB1Enabled = $smb.EnableSMB1Protocol
SMBSigningRequired = $smb.RequireSecuritySignature
LDAPSigning = $ntds.LDAPServerIntegrity
LsaProtection = $lsa.RunAsPPL
PrintSpooler = "$($spl.Status) / $($spl.StartType)"
}
} | Format-List PSComputerName, LastUpdate, SMB1Enabled, SMBSigningRequired, LDAPSigning, LsaProtection, PrintSpoolerA blank value means the setting has never been configured and Windows is using its default.
What to look for
| Result | What it means | Guide |
|---|---|---|
| Machine account quota is 10 | Any user can join ten computers to the domain. | Stop users joining computers to the domain |
| Lockout threshold is 0 | Passwords can be guessed without limit. | Set password and lockout policies |
| Minimum length under 14 | Short passwords are allowed. | Set password and lockout policies |
| Only Administrator in Domain Admins | One shared account does everything. | Create a named domain admin account |
| Members in Schema Admins or Enterprise Admins | Forest-wide rights are held all the time. | Empty Schema Admins and Enterprise Admins |
| Print Spooler is Running | A service DCs do not need is exposed. | Turn off Print Spooler on domain controllers |
| Recycle Bin has no enabled scopes | Deleted accounts cannot be restored easily. | Finish the domain setup |
| LastUpdate is months old | The server is missing security updates. | Run Windows Update, one DC at a time. |
Done when
Check
You have the output saved somewhere safe and a list of what to fix first.


