Enabling DHCP logging in Windows 11 via PowerShell allows administrators to monitor and troubleshoot DHCP server activity by recording lease events, renewals, and denials to a log file. This is useful for network auditing, diagnosing IP address conflicts, or verifying DHCP scope behavior. No additional software is required—only administrative access to PowerShell.
What You'll Need
- Windows 11 Pro, Enterprise, or Education edition (DHCP logging is not available on Home edition)
- Administrator privileges on the local machine
- PowerShell 5.1 or later (built into Windows 11)
- DHCP Server role installed (if logging a DHCP server; for client-side logging, this step is not required)
Step-by-Step
- Open PowerShell as Administrator: Press Win + X and select Windows Terminal (Admin) or PowerShell (Admin). If prompted by User Account Control, click Yes.
- Verify the DHCP Server service is running (if configuring a DHCP server): Run
Get-Service -Name DHCPServer. If the status is not Running, start it withStart-Service -Name DHCPServer. - Enable DHCP logging for the DHCP Server service: Execute
Set-DhcpServerv4LogSetting -LogState Enabled. This command activates logging for IPv4 DHCP server events. - (Optional) Specify a custom log file path: By default, logs are stored in
%SystemRoot%\System32\dhcp. To change this, useSet-DhcpServerv4LogSetting -LogPath "D:\DhcpLogs", replacing the path with your desired folder. Ensure the folder exists and the DHCP service account has write permissions. - (Optional) Configure log file size and rotation: Set the maximum log size before rotation with
Set-DhcpServerv4LogSetting -MaxSizeMB 100(adjust the value as needed). Set the maximum number of log files to retain withSet-DhcpServerv4LogSetting -MaxFiles 10. - Confirm the logging settings are applied: Run
Get-DhcpServerv4LogSettingto view the current configuration, including LogState, LogPath, MaxSizeMB, and MaxFiles. - Generate test DHCP activity to verify logging: On a client machine, renew its IP lease using
ipconfig /renewor restart the DHCP Client service (Restart-Service Dhcp). - Check the log file for entries: Navigate to the log path (default or custom) and open the most recent
DhcpSrvLog-.logfile with Notepad or a text editor. Look for entries related to lease assignments, renewals, or denials.
Common Mistakes
- Running PowerShell without administrator privileges, which results in access denied errors when modifying DHCP settings.
- Assuming DHCP logging is available on Windows 11 Home edition—it is not, as the DHCP Server role cannot be installed.
- Specifying a log path on a drive or folder that the DHCP service account (NETWORK SERVICE) cannot access, causing logging to fail silently.
- Neglecting to start the DHCP Server service before enabling logging, leading to no log generation.
- Setting the log file size too low (e.g., 1 MB), causing rapid rotation and loss of useful data.
Tips
- Use
-Verbosewith DHCP PowerShell commands to see detailed output during execution. - Regularly archive old log files to prevent disk space issues, especially on busy networks.
- Enable logging temporarily for troubleshooting, then disable it afterward to reduce performance overhead.
- Combine DHCP logs with Event Viewer (
eventvwr.msc) under Applications and Services Logs > Microsoft > Windows > DHCP-Operational for more detailed debugging. - If managing multiple DHCP servers, use PowerShell remoting (
Invoke-Command) to apply logging settings across servers consistently.
Troubleshooting
If DHCP logging is not working after following the steps:
- Check that the DHCP Server service is running:
Get-Service -Name DHCPServer. If not, start it. - Verify the log path exists and is writable: Manually test by creating a file in the folder using
New-Item -Path "D:\DhcpLogs\test.txt" -ItemType File. If this fails, correct permissions or choose another location. - Ensure logging is actually enabled: Re-run
Get-DhcpServerv4LogSettingand confirmLogStateshows Enabled. - Look for blocked access in Windows Defender Firewall with Advanced Security—though rare, outbound logging restrictions could interfere if logs are written to a network share.
- Review the DHCP Server operational logs in Event Viewer for errors related to logging initialization.
- Restart the DHCP Server service after changing settings:
Restart-Service -Name DHCPServer. - If using a custom log path on a non-system drive, ensure the drive is always available and not encrypted or locked during boot.
Frequently Asked Questions
Can I enable DHCP logging on Windows 11 Home edition?
No, the DHCP Server role and its logging features are not available in Windows 11 Home edition. You need Pro, Enterprise, or Education.
Where are DHCP logs stored by default?
By default, DHCP server logs are stored in %SystemRoot%\System32\dhcp, typically C:\Windows\System32\dhcp.
Do I need to reboot after enabling DHCP logging?
No, changes take effect immediately after restarting the DHCP Server service or upon the next DHCP transaction.
Can I log DHCP client activity instead of server activity?
Windows does not provide built-in logging for DHCP client lease acquisition via PowerShell. Client-side DHCP events are logged in Event Viewer under Applications and Services Logs > Microsoft > Windows > DHCP-Client.
How much disk space do DHCP logs typically use?
Usage varies by network size, but a busy server may generate 10–50 MB per day. With default settings (100 MB max size, 10 files), expect up to ~1 GB of retained logs.
Is it safe to delete old DHCP log files manually?
Yes, you can manually delete old DhcpSrvLog-.log files from the log folder as long as the DHCP service is not actively writing to them. It’s safer to rely on log rotation or stop the service briefly during cleanup.