Troubleshoot NETLOGON.LOG

Netlogon.log has to offer – trying to track down the source of a user account’s lockouts or find subnets that haven’t been put into an Active Directory site yet.
DBFlag is set to 0x2080ffff, just like this TechNet article. That quick looks makes it look like your options are EVERYTHING! or nothing.
Data Source: http://support.microsoft.com/kb/109626
All descriptions as-is from Microsoft.

Basic Netlogon Flags

Flag NameValueDescription
NL_INIT0x00000001Initialization
NL_MISC0x00000002Misc debug
NL_LOGON0x00000004Logon processing
NL_SYNC0x00000008Synchronization and replication
NL_MAILSLOT0x00000010Mailslot messages
NL_SITE0x00000020Sites
NL_CRITICAL0x00000100Only real important errors
NL_SESSION_SETUP0x00000200Trusted Domain maintenance
NL_DOMAIN0x00000400Hosted Domain maintenance
NL_20x00000800
NL_SERVER_SESS0x00001000Server session maintenance
NL_CHANGELOG0x00002000Change Log references
NL_DNS0x00004000DNS name registration

Verbose Netlogon Flags

Flag NameValueDescription
NL_WORKER0x00010000Debug worker thread
NL_DNS_MORE0x00020000Verbose DNS name registration
NL_PULSE_MORE0x00040000Verbose pulse processing
NL_SESSION_MORE0x00080000Verbose session management
NL_REPL_TIME0x00100000replication timing output
NL_REPL_OBJ_TIME0x00200000replication objects get/set timing output
NL_ENCRYPT0x00400000debug encrypt and decrypt across net
NL_SYNC_MORE0x00800000additional replication dbgprint
NL_PACK_VERBOSE0x01000000Verbose Pack/Unpack
NL_MAILSLOT_TEXT0x02000000Verbose Mailslot messages
NL_CHALLENGE_RES0x04000000challenge response debug
NL_SITE_MORE0x08000000Verbose sites

Netlogon Control Flags

Flag NameValueDescription
NL_INHIBIT_CANCEL0x10000000Don’t cancel API calls
NL_TIMESTAMP0x20000000TimeStamp each output line
NL_ONECHANGE_REPL0x40000000Only replicate one change per call
NL_BREAKPOINT0x80000000Enter debugger on startup
Right now, We need look at account lockouts and subnetless IPs, even on our busiest DCs. A very busy DC can blow through a 100MB log file allowance in a few hours, and even with Netlogon.bak
We need capture LESS diagnostic information, Because heavy logging can cause its own problems – read and think about this article from the Directory Services team.
https://blogs.technet.microsoft.com/askds/2008/04/02/directory-services-debug-logging-primer/
So, 0x2080ffff - 0x00000020 = 0x2080ffdf. I tried the nice .NET/PowerShell way, but it failed against a 2003 server. Back to the old-fashioned way – still possible from within a PowerShell script.
reg add \\$computerName\HKLM\SYSTEM\CurrentControlSet\Services\NetLogon\Parameters" /v DBFlag /t REG_DWORD /d 0x2080ffdf /f
reg add "\\$computerName\HKLM\SYSTEM\CurrentControlSet\Services\NetLogon\Parameters" /v MaximumLogFileSize /t REG_DWORD /d 100000000 /f
reg query "\\$computerName\HKLM\SYSTEM\CurrentControlSet\Services\NetLogon\Parameters" /v DBFlag
reg query "\\$computerName\HKLM\SYSTEM\CurrentControlSet\Services\NetLogon\Parameters" /v MaximumLogFileSize
Finish up by stopping and starting the Netlogon service, You need to use sc.exe in PowerShell, because sc is an alias for Set-Content:
sc.exe \\computerName stop netlogon
sc.exe \\computerName start netlogon
Find the table of the result codes to interpret the [LOGON] entries (Log File Error Codes” http://technet.microsoft.com/en-us/library/cc776964.aspx )
Log CodeDescription
0x0Successful login
0xC0000064The specified user does not exist
0xC000006AThe value provided as the current password is not correct
0xC000006CPassword policy not met
0xC000006DThe attempted logon is invalid due to a bad user name
0xC000006EUser account restriction has prevented successful login
0xC000006FThe user account has time restrictions and may not be logged onto at this time
0xC0000070The user is restricted and may not log on from the source workstation
0xC0000071The user account’s password has expired
0xC0000072The user account is currently disabled
0xC000009AInsufficient system resources
0xC0000193The user’s account has expired
0xC0000224User must change his password before he logs on the first time
0xC0000234The user account has been automatically locked
The most important ones to distinguish between are 0xC000006A (bad password was entered this time – these ARE the droids you’re looking for) and 0xC0000234 (a logon attempt has been made with a user account that has been locked out, but this says nothing about whether this current attempt used a good or bad password).

Below update not tested by myself:
The cmdlet I use to collect NetLogon logs for analysis on my local machine. It must be used in an Powershell instance that was started as a Domain Admin or other account with access to the DC’s %Windows%\Debug directory. Combine in a pipeline with a list of your DCs to speed it up.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function Get-NetLogonLog {
Param(
$computerName
,$destinationPath="C:\temp\netlogon"
)
  if (-not (Test-Path $destinationPath) ) {
   New-Item -Path $destinationPath -ItemType Directory
  }
  if (Test-Path "\\$computerName\c$\WINDOWS\Debug\Netlogon.log") {
      Copy-Item -Path "\\$computerName\c$\WINDOWS\Debug\Netlogon.log" -Destination "$destinationPath\$computerName-Netlogon.log"
  }
  elseif (Test-Path "\\$computerName\c$\WINNT\Debug\Netlogon.log") {
    Copy-Item -Path "\\$computerName\c$\WINNT\Debug\Netlogon.log" -Destination "$destinationPath\$computerName-Netlogon.log"
  }
  else {
    "Could not find Netlogon.log for $computerName" | Out-File -FilePath "$destinationPath\errors.log" -Append
  }
}
Finally, here are functions to separate the entries I want into different files – separate from the function to gather the NetLogon.log files because it does NOT need to be run as someone with access to your DCs’ c:\Windows\Debug directories…
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function Test-NetLogonEntryBadSubnet {
PROCESS {
  if ($_ -like "*NO_CLIENT_SITE*") {
    $_
    }
  }
}
function Test-NetLogonEntryBadLogon {
PROCESS {
  if ($_ -like "*\[LOGON\]*0xC000006A*" -or $_ -like "*\[LOGON\]*0xC0000234*") {
    $_
    }
  }
}
Function Test-NonTransitiveLogon {
Param($PcNamePrefix = "P0")
PROCESS {
  if (($_ -like "*\[LOGON\]*$PcNamePrefix*0x0*") -and ($_ -notlike "*transit*")") {
    $_
    }
  }
}
function Get-NetLogonBadLogonOrSubnet {
PROCESS {
  if ($_ -like "*NO_CLIENT_SITE*" -or $_ -like "*\[LOGON\]*0xC000006A*" -or $_ -like "*\[LOGON\]*0xC0000234*") {
    $_
    }
  }
}
function Write-NetlogonExtracts {
Param(
$directory="c:\temp\netlogon"
, $computerName
, $sourceFile="$directory\$computerName-netlogon.log"
, $targetBadSubnetFile="$directory\$computerName-BadSubnets.txt"
, $targetBadLogonFile="$directory\$computerName-BadLogons.txt"
, $targetDirectLogonFile="$directory\$computerName-DirectLogons.txt"
, $PcNamePrefix = "P0"
)
# Faster to only filter for one match at a time. Not sure why.
  Get-Content $sourceFile | Test-NetLogonEntryBadSubnet | Out-File -FilePath $targetBadSubnetFile
  Get-Content $sourceFile | Test-NetLogonEntryBadLogon | Out-File -FilePath $targetBadLogonFile
  Get-Content $sourceFile | Test-NonTransitiveLogon -PcNamePrefix $PcNamePrefix | Out-File -FilePath $targetDirectLogonFile
}

Comments

Popular posts from this blog

altiris software key

Service Principal Names (SPNs) SetSPN Syntax (Setspn.exe)

Troubleshooting Netlogon Error Codes