🏠 Home / Hub

Lesson 6 — Group Policy (GPO)

Group Policy is the primary mechanism for enforcing security settings, configurations, and software deployments across all computers and users in an Active Directory domain. A single policy can affect thousands of machines simultaneously.

1. What is Group Policy?

A Group Policy Object (GPO) is a collection of settings that can be applied to computers and/or users in an AD domain. GPOs are linked to Sites, Domains, or Organizational Units (OUs).

2. GPO Processing Order: LSDOU

When multiple GPOs apply to an object, they are processed in this order. Later-processed policies win when there is a conflict (OU GPOs have highest priority):

1
Local
2
Site
3
Domain
4
OU
5
Child OU
The last GPO processed wins. Since OU is processed last, its settings override domain-level settings. Within the same level, GPOs are processed top-to-bottom in the "Linked GPOs" list (lower link order = higher priority).

Special Processing Modifiers

ModifierApplied OnEffect
Block InheritanceOUStops all GPOs from parent containers from applying to this OU. Useful for isolating a department from domain-wide policies.
Enforced (No Override)GPO linkForces this GPO to take precedence over all other GPOs, even if a child OU has Block Inheritance. Used for critical security policies.
DisabledGPO linkTemporarily disables the GPO link without deleting it. Useful for testing.

3. GPMC — Group Policy Management Console

# Install GPMC (if not already present)
Install-WindowsFeature -Name GPMC

# Open GPMC
gpmc.msc

# Key operations in GPMC:
# Right-click domain/OU → Create a GPO in this domain and Link it here
# Right-click domain/OU → Link an Existing GPO (reuse an existing GPO)
# Right-click GPO → Edit (opens Group Policy Management Editor)
# Right-click GPO → GPO Status (enable/disable Computer or User configuration)
# Group Policy Results wizard — what policies actually applied to a specific user/computer

Default Built-in GPOs

GPO NameLinked ToPurpose
Default Domain PolicyDomain rootDomain-wide settings: Password Policy, Account Lockout Policy, Kerberos Policy. Edit this GPO only for those three policy areas.
Default Domain Controllers PolicyDomain Controllers OUDC-specific settings: user rights assignments, audit policy. Controls who can log on to DCs.
Microsoft recommends not editing the Default Domain Policy for anything other than the Password Policy, Account Lockout Policy, and Kerberos Policy. Create new GPOs for everything else to make rollback easier.

4. Computer vs User Configuration

Every GPO has two sections. Understanding which to use is fundamental:

SectionApplies ToApplied WhenExample Settings
Computer ConfigurationComputer accounts (the machine)Computer startup, every 90 min in backgroundPassword policy, firewall rules, software installation, startup scripts, Windows Update settings, disable USB
User ConfigurationUser accounts (the person)User logon, every 90 min in background (for user in context)Desktop wallpaper, folder redirection, drive mapping, logon scripts, Start menu restrictions, IE proxy settings
A GPO linked to a computer's OU applies its Computer Configuration to that computer, regardless of who logs in. A GPO linked to a user's OU applies its User Configuration to that user, regardless of which computer they log in to — unless Loopback Processing is configured.
# GPO path structure in GPMC editor:
# Computer Configuration
#   ├── Policies
#   │   ├── Windows Settings
#   │   │   ├── Security Settings
#   │   │   │   ├── Account Policies (Password, Lockout, Kerberos)
#   │   │   │   ├── Local Policies (Audit, User Rights, Security Options)
#   │   │   │   └── Windows Firewall with Advanced Security
#   │   │   └── Scripts (Startup/Shutdown)
#   │   └── Administrative Templates (Registry-based policies)
#   │       ├── Windows Components
#   │       ├── System
#   │       └── Network
#   └── Preferences (persistent settings, not enforced like Policies)

# User Configuration
#   ├── Policies
#   │   ├── Windows Settings
#   │   │   ├── Scripts (Logon/Logoff)
#   │   │   └── Folder Redirection
#   │   └── Administrative Templates
#   └── Preferences
#       ├── Drive Maps (map network drives)
#       ├── Registry
#       ├── Files and Folders
#       └── Shortcuts

5. Essential Security Policies

Password Policy

Located: Computer Config → Policies → Windows Settings → Security Settings → Account Policies → Password Policy

Must be set in the Default Domain Policy (domain-level, not OU-level, unless using Fine-Grained Password Policies).

SettingRecommended ValuePurpose
Minimum password length14 characters (NIST recommends 8+ with MFA)Prevents short, easily guessable passwords
Password complexity requirementsEnabledRequires uppercase, lowercase, digit, symbol
Maximum password age0 (never expire) or 90 daysNIST 2024 recommends not expiring unless breach occurs
Minimum password age1 dayPrevents immediate reuse after reset
Password history24 passwordsPrevents reusing recent passwords
Reversible encryptionDisabledNever enable — stores password in plaintext

Account Lockout Policy

SettingRecommended ValueNotes
Account lockout threshold5 invalid attempts0 = never locks out (not recommended)
Account lockout duration15 minutes (or 0 = admin must unlock)0 forces admin unlock — more secure but more work
Reset account lockout counter after15 minutesCounter resets after this time without a lockout

Audit Policy Settings

Located: Computer Config → Policies → Windows Settings → Security Settings → Local Policies → Audit Policy (or Advanced Audit Policy Configuration for more granularity)

PolicySettingEvents Generated
Audit logon eventsSuccess, Failure4624 (logon), 4625 (failed logon), 4634 (logoff)
Audit account managementSuccess, Failure4720 (user created), 4722 (enabled), 4740 (locked out)
Audit object accessSuccess, FailureFile/folder access (requires SACL on objects too)
Audit privilege useFailureUnauthorized privilege escalation attempts
Audit policy changeSuccessChanges to audit/security policy
Audit system eventsSuccess, FailureSystem startup, shutdown, log cleared (1102)

6. Practical GPO Examples

Disable USB Storage Devices

Computer Config → Policies → Windows Settings → Security Settings → System Services, or Administrative Templates:

# GPO Path: Computer Configuration → Policies → Administrative Templates →
#   System → Removable Storage Access
# Setting: "All Removable Storage classes: Deny all access" → Enabled

# Alternative via registry (also deployable via GPO Preferences):
# HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR
# Start = 4 (disabled) instead of 3 (enabled)

Screen Lock / Password on Wake

# GPO Path: Computer Configuration → Policies → Administrative Templates →
#   Control Panel → Personalization
# Settings:
# "Enable screen saver"           → Enabled
# "Screen saver timeout"          → Enabled, 900 seconds (15 min)
# "Password protect the screen saver" → Enabled
# "Force specific screen saver"   → Enabled, scrnsave.scr (blank screen)

Disable Control Panel for Standard Users

# GPO Path: User Configuration → Policies → Administrative Templates →
#   Control Panel
# Setting: "Prohibit access to Control Panel and PC Settings" → Enabled

Map a Network Drive via GPO Preferences

# GPO Path: User Configuration → Preferences → Windows Settings → Drive Maps
# New → Mapped Drive:
# Action: Create (or Update)
# Location: \\SRV-FILE01\Shared
# Drive Letter: S:
# Label: Company Share
# Reconnect: Checked
# Item-level targeting: "Group" → GG-IT-Staff (only applies to IT group)

Configure Windows Update via GPO

# GPO Path: Computer Configuration → Policies → Administrative Templates →
#   Windows Components → Windows Update

# Key settings:
# "Configure Automatic Updates" → Enabled
#   Option: 4 - Auto download and schedule the install
#   Schedule: Every Sunday at 3:00 AM
# "Specify intranet Microsoft update service location" → Enabled
#   Set update service: http://WSUS-SERVER:8530
# "No auto-restart with logged on users" → Enabled (avoid surprise reboots)

7. Software Deployment via GPO

GPO can deploy MSI packages to computers (at startup) or users (at logon). The MSI must be in a network share accessible by the target computers.

# Requirements for GPO software deployment:
# 1. MSI file must be on a UNC network share: \\SRV-FILE01\Software\App.msi
# 2. Share must be readable by computer accounts (DOMAIN\Domain Computers)
# 3. NTFS permissions must also allow read access

# GPO Path: Computer Configuration → Policies → Software Settings → Software Installation
# Right-click → New → Package
# Browse to UNC path: \\SRV-FILE01\Software\App.msi
# Deployment method:
#   - Assigned: Installs automatically, appears in Start menu, installed if user clicks shortcut
#   - Published (User Config only): Available in Control Panel → Programs but not auto-installed

# Verify deployment after gpupdate
Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='MsiInstaller'} -MaxEvents 20 |
  Select-Object TimeCreated, Message | Format-List
For complex software deployments (non-MSI, configuration needed, staged rollouts), consider Microsoft Endpoint Configuration Manager (MECM/SCCM) or Microsoft Intune instead of GPO software deployment.

8. Folder Redirection

Folder Redirection moves Windows user profile folders (Desktop, Documents, Downloads, etc.) from the local machine to a network share. Users' data is then centrally stored and backed up automatically.

# Prerequisites:
# 1. Create file share: \\SRV-FILE01\UserFolders$  (dollar sign = hidden share)
# 2. Share permissions: Domain Users = Full Control (NTFS permissions manage real access)
# 3. NTFS permissions on folder:
#    - CREATOR OWNER: Full Control (subfolders and files only)
#    - Domain Users: List folder / Read data + Create folders (this folder only)

# GPO Path: User Configuration → Policies → Windows Settings → Folder Redirection
# Right-click "Documents" → Properties
# Setting: Basic - Redirect everyone's folder to the same location
# Target folder location: Create a folder for each user under the root path
# Root Path: \\SRV-FILE01\UserFolders$
# (Result: \\SRV-FILE01\UserFolders$\%username%\Documents)
# Check "Grant the user exclusive rights" and "Move the contents to the new location"
Test Folder Redirection on a small pilot OU before rolling out to all users. If the file server is unavailable, users cannot log on (unless offline caching is enabled). Also verify sufficient storage on the file server.

9. Scripts: Startup/Shutdown and Logon/Logoff

# Computer Configuration → Policies → Windows Settings → Scripts (Startup/Shutdown)
# Startup scripts run as SYSTEM before login screen appears
# Shutdown scripts run as SYSTEM before machine powers off

# User Configuration → Policies → Windows Settings → Scripts (Logon/Logoff)
# Logon scripts run as the user after successful logon
# Logoff scripts run as the user when they log off

# Scripts must be placed in the GPO's script folder:
# \\domain\SYSVOL\domain\Policies\{GUID}\Machine\Scripts\Startup\
# \\domain\SYSVOL\domain\Policies\{GUID}\User\Scripts\Logon\

# Example startup script (sets firewall rule):
# startup.ps1
New-NetFirewallRule -DisplayName "Block TeamViewer" -Direction Outbound `
  -RemotePort 5938 -Protocol TCP -Action Block -Profile Any

# Example logon script (map drives based on group membership):
# logon.ps1
$groups = (New-Object System.DirectoryServices.DirectorySearcher(
    [adsi]"",[string]::Format("(&(objectCategory=User)(sAMAccountName={0}))",$env:USERNAME),
    "memberOf")).FindOne().Properties["memberOf"]

if ($groups -match "GG-IT-Staff") {
    net use I: \\SRV-FILE01\IT /persistent:no
}
if ($groups -match "GG-HR-Staff") {
    net use H: \\SRV-FILE01\HR /persistent:no
}

10. Security Filtering and WMI Filters

Security Filtering

By default, "Authenticated Users" is in the Security Filtering of every GPO — meaning it applies to all users and computers. Replace this to target a specific group:

# GUI: In GPMC, select the GPO → Scope tab → Security Filtering
# Remove "Authenticated Users" → Add "GG-IT-Staff"
# This GPO now only applies to members of GG-IT-Staff

# PowerShell equivalent:
$gpName = "IT-Workstation-Policy"
Set-GPPermissions -Name $gpName -PermissionLevel GpoApply `
  -TargetName "GG-IT-Staff" -TargetType Group
Set-GPPermissions -Name $gpName -PermissionLevel None `
  -TargetName "Authenticated Users" -TargetType Group

WMI Filters

WMI Filters apply a GPO only when a WMI query returns TRUE. This lets you target GPOs based on OS version, hardware, or other conditions.

# Example WMI Filters (WQL syntax):
# Apply only to Windows 10 machines:
SELECT * FROM Win32_OperatingSystem WHERE Caption LIKE "%Windows 10%"

# Apply only to laptops (systems with a battery):
SELECT * FROM Win32_Battery

# Apply only to 64-bit systems:
SELECT * FROM Win32_OperatingSystem WHERE OSArchitecture = "64-bit"

# Apply only to systems with more than 8GB RAM:
SELECT * FROM Win32_PhysicalMemory WHERE Capacity >= 8589934592

# Link WMI filter to GPO:
# In GPMC, select the GPO → Scope tab → WMI Filtering → select your filter from dropdown

11. GPO Troubleshooting

# Force immediate GPO refresh on local machine
gpupdate /force              # Refreshes both Computer and User policies
gpupdate /target:computer    # Only Computer Configuration
gpupdate /target:user        # Only User Configuration
gpupdate /boot               # Apply policies requiring restart and reboot
gpupdate /logoff             # Apply policies requiring logoff and logoff

# Get applied GPOs for the CURRENT computer and CURRENT user
gpresult /r                  # Summary in console
gpresult /h C:\GPReport.html # Full HTML report with all settings and status
gpresult /v                  # Verbose — shows every applied setting

# Remote: get GPO results for a specific user/computer
gpresult /s SRV-WEB01 /user LAB\jsmith /h C:\Reports\jsmith_gpo.html

# RSOP (Resultant Set of Policy) — older GUI tool
rsop.msc

# Check GPO event logs
# Event Viewer → Applications and Services Logs → Microsoft → Windows → Group Policy → Operational
Get-WinEvent -LogName "Microsoft-Windows-GroupPolicy/Operational" -MaxEvents 20 |
  Select-Object TimeCreated, LevelDisplayName, Message | Format-List

# Verify SYSVOL replication (GPOs won't apply if SYSVOL is not replicated)
dfsrdiag ReplicationState
Get-DfsrConnection | Select-Object GroupName, SendingMember, ReceivingMember, State

Common GPO Issues and Fixes

SymptomLikely CauseFix
GPO setting not applyingSecurity filtering — user not in right groupCheck Scope tab in GPMC; run gpresult /r
GPO applies but setting revertsHigher-priority GPO is overridingUse gpresult /h to see winning GPO; check link order and Enforced flag
Password policy not workingPassword policy must be at DOMAIN level, not OUEdit Default Domain Policy; or use Fine-Grained Password Policy (PSO)
Drive maps not appearingUser Configuration requires user refresh; check item-level targetingLog off and back on; check group membership for item-level targeting
Software not installingUNC path not accessible from target computerTest UNC path from computer account context; check share/NTFS permissions

Lesson 6 Complete

You can now create and link GPOs, configure password/lockout/audit policies, deploy software, redirect folders, set up logon scripts, filter by security group or WMI conditions, and diagnose why a policy is or is not applying.

Next: Windows Server Security →

📌 Study Checklist