Solved

NO_CLIENT_SITE entries in netlogon.log

Posted on 2006-06-13
7
4,737 Views
Last Modified: 2012-06-21
I am looking to find any straggling IP address ranges to configure as subnets in AD. To do this, I was thinking I could query each DC (30 of them) for NO_CLIENT_SITE entries in their netlogon.log files.

On a Unix system I could grep these values. How do I do this with an MS Windows app?

Thank you,
John
0
Comment
Question by:johndarby
  • 5
  • 2
7 Comments
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 16898542

Hey John,

I wrote a script that reads them and creates a couple of reports - the first is just a raw list of IP Addresses, the second is a list of subnets that would remove the problem entirely.

What IP Range do you operate on? And what's your preferred Mask Length?

This is the Forest-wide version of the script. I've posted this one rather than a Domain Only one as it has far more functionality included than the Domain Only version. I'm not quite sure how it will take to running on a single domain, it might work just fine. Otherwise I'll update the Domain version in the morning and post that.

It's also configured to work with my normal network ranges which lie in 10.x.x.x\18 and 192.168.x.x\24. Adding another one or changing those is no problem, but I need to know the range and the mask.

If you do happen to be running a forest then save as .vbs and run as an enterprise admin.


' ScanNetlogon.vbs
'
' Script to Read the Netlogon log files from %SystemRoot%\Debug\netlogon.log for all Domain
' Controllers in the Forest and work out which subnets are missing from AD Configuration.
'
' Author: Chris Dent
' Last Modified: 12/06/2006
'
' Change Log:
' * Added GetConfiguredSubnets Subroutine; used to remove any Subnets that have been added since the
'   log record.
' * Added ReadExpired Subroutine; Used to force the script to ignore certain subnets if they have expired.

Option Explicit

Const REG_HKLM = &H80000002
Const WBEM_RETURN_IMMEDIATELY = &H10
Const WBEM_FORWARD_ONLY = &H20

Dim objFileSystem, objShell, objConfiguredSubnets, objExpiredSubnets, objUnconfiguredSubnets, objUnconfiguredIPs
Dim strOrigSuffixes, strDN
Dim arrDCs(), arrDomainDNs, arrDomainNames
Dim booSetSuffixes
Dim i

'
' Functions
'

Function GetForestContexts

      ' Returns a array containing all Domains (Distinguished Name) in the active Forest

      Dim objRootDSE, objForestRoot
      Dim strForestRoot, strSubDomain
      Dim arrDomainDNs(), arrTemp

      Set objRootDSE = GetObject("LDAP://RootDSE")
      strForestRoot = objRootDSE.Get("rootDomainNamingContext")
      Set objForestRoot = GetObject("LDAP://" & strForestRoot)

      ReDim Preserve arrDomainDNs(0)
      arrDomainDNs(0) = strForestRoot

      ' Rebuild Domains List removing the DNS and Configuration contexts

      arrTemp = objForestRoot.Get("subRefs")
      For Each strSubDomain in arrTemp
            If (InStr(strSubDomain, "DnsZones") = 0) And (InStr(strSubDomain, "Configuration") = 0) Then
                  ReDim Preserve arrDomainDNs(UBound(arrDomainDNs) + 1)
                  arrDomainDNs(UBound(arrDomainDNs)) = strSubDomain
            End If
      Next

      Set objForestRoot = Nothing
      Set objRootDSE = Nothing
      
      GetForestContexts = arrDomainDNs
End Function

Function ConvertToDNS(arrDomainDNs)

      ' Converts Distinguished Names to DNS Names

      Dim strDN, strDomainName
      Dim arrDomainNames()
      Dim i
      
      i = 0
      For Each strDN in arrDomainDNs
            ReDim Preserve arrDomainNames(i)
            strDomainName = Replace(strDN, ",DC=", ".")
            strDomainName = Replace(strDomainName, "DC=", "")
            arrDomainNames(i) = strDomainName
            i = i + 1
      Next
      
      ConvertToDNS = arrDomainNames
End Function

Function GetNetworkAddress(strIP, intMaskLength)

      ' Generates the Network Address from the IP and Mask

      Dim strOctet, strBinOctet, strBinIP, strBinMask, strIPBit, strMaskBit
      Dim strBinNetwork, strNetworkAddress
      Dim i, intTemp, intOctet, intBit
      Dim arrOctets

      arrOctets = Split(strIP, ".")
      For Each strOctet in arrOctets
            intTemp  = 0
            strBinOctet = ""
            For i = 0 To 7
                  If intTemp + 2^(7 - i) <= CInt(strOctet) Then
                        strBinOctet = strBinOctet & "1"
                        intTemp = intTemp + 2^(7 - i)
                  Else
                        strBinOctet = strBinOctet & "0"
                  End If
            Next
            strBinIP = strBinIP & "." & strBinOctet
      Next
      strBinIP = Right(strBinIP, Len(strBinIP) - 1)

      For i = 1 to 32
            If i <= intMaskLength Then
                  strBinMask = strBinMask & "1"
            Else
                  strBinMask = strBinMask & "0"
            End If
            If i = 8 Or i = 16 Or i = 24 Then
                  strBinMask = strBinMask & "."
            End If
      Next

      For i = 1 to Len(strBinIP)
            strIPBit = Mid(strBinIP, i, 1)
            strMaskBit = Mid(strBinMask, i, 1)
            If strIPBit = "1" And strMaskBit = "1" Then
                  strBinNetwork = strBinNetwork & "1"
            ElseIf strIPBit = "." Then
                  strBinNetwork = strBinNetwork & strIPBit
            Else
                  strBinNetwork = strBinNetwork & "0"
            End If
      Next

      arrOctets = Split(strBinNetwork, ".")
      For Each strOctet in arrOctets
            intOctet = 0
            For i = 0 to 7
                  intBit = CInt(Mid(strOctet, i + 1, 1))
                  If intBit = 1 Then
                        intOctet = intOctet + 2^(7 - i)
                  End If
            Next
            strNetworkAddress = strNetworkAddress & "." & CStr(intOctet)
      Next
      GetNetworkAddress = Right(strNetworkAddress, Len(strNetworkAddress) - 1)
End Function

'
' Subroutines
'

'
' AD
'

Sub GetDCs(strDN)

      ' Gets the DNS Host Name for each Domain Controller

      Dim objOU, objDC

      On Error Resume Next

      Set objOU = GetObject("LDAP://" & strDN)
      
      For Each objDC in objOU
            If objDC.Class = "organizationalUnit" Then
                  GetDCs objDC.Get("distinguishedName")
            ElseIf objDC.Class = "computer" Then
                  ReDim Preserve arrDCs(i)
                  arrDCs(i) = objDC.Get("dNSHostName")
                  i = i + 1
            End If
      Next
      
      On Error Goto 0

End Sub

Sub GetConfiguredSubnets

      Dim objRootDSE, objSubnets, objSubnet
      Dim strSubnets, strNetworkAddress
      Dim arrTemp
      Dim intMaskLength

      Set objRootDSE = GetObject("LDAP://RootDSE")
      strSubnets = "CN=Subnets,CN=Sites," & objRootDSE.GEt("configurationNamingContext")
      Set objRootDSE = Nothing

      Set objSubnets = GetObject("LDAP://" & strSubnets)
      For Each objSubnet in objSubnets
            arrTemp = Split(objSubnet.Get("name"), "/")
            strNetworkAddress = arrTemp(0)
            intMaskLength = CInt(arrTemp(1))
            strNetworkAddress = strNetworkAddress & "\" & CStr(intMaskLength)

            If Not objConfiguredSubnets.Exists(strNetworkAddress) Then
                  objConfiguredSubnets.Add strNetworkAddress, ""
            End If
      Next
      Set objSubnets = Nothing
End Sub

'
' Registry
'

Sub SetSuffixes

      ' Convert DNS Domain Names to Suffixes and check against IP Configuration
      ' Just works better with these set

      Dim objRegistry
      Dim strKeyPath, strValueName, strSuffixes, strDomainName

      Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")
      strKeyPath = "System\CurrentControlSet\Services\TCPIP\Parameters"
      strValueName = "SearchList"
      objRegistry.GetStringValue REG_HKLM, strKeyPath, strValueName, strOrigSuffixes

      For Each strDomainName in arrDomainNames
            If InStr(1, strOrigSuffixes, strDomainName, VbTextCompare) = 0 Then
                  booSetSuffixes = True
            End If
      Next

      If booSetSuffixes = True Then
            For Each strDomainName in arrDomainNames
                  strSuffixes = strSuffixes & "," & strDomainName
            Next
      
            strSuffixes = Right(strSuffixes, Len(strSuffixes) - 1)
            objRegistry.SetStringValue REG_HKLM, strKeyPath, strValueName, strSuffixes
            objShell.Run "ipconfig /renew"
      End If

      Set objRegistry = Nothing
End Sub

Sub ResetSuffixes

      ' Puts the orignal Suffix Search List back

      Dim objRegistry
      Dim strKeyPath, strValueName

      If booSetSuffixes = True Then
            Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")
            strKeyPath = "System\CurrentControlSet\Services\TCPIP\Parameters"
            strValueName = "SearchList"

            objRegistry.SetStringValue REG_HKLM, strKeyPath, strValueName, strOrigSuffixes
            objShell.Run "ipconfig /renew"
            Set objRegistry = Nothing
      End If
End Sub

'
' Data Handling
'

Sub GatherLogs

      ' Gather Files. Copy the files to a local repository for parsing.

      Dim objFolder, objFile, objWMIService, objItem
      Dim colOS
      Dim strDC, strFolder, strFile

      If Not objFileSystem.FolderExists("NetLogon") Then
            objFileSystem.CreateFolder("NetLogon")
      End If
      
      Set objFolder = objFileSystem.GetFolder("NetLogon")
      For Each objFile in objFolder.Files
            objFile.Delete
      Next
      Set objFolder = Nothing

      For Each strDC in arrDCs
            On Error Resume Next
      
            strFolder = ""
            Set objWMIService = GetObject("winmgmts:\\" & strDC & "\root\CIMV2")
            Set colOS = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
                        WBEM_RETURN_IMMEDIATELY + WBEM_FORWARD_ONLY)
                  
            For Each objItem in colOS
                  strFolder = objItem.WindowsDirectory
            Next
      
            On Error Goto 0

            If strFolder = "" Then
                  strFolder = "\\" & strDC & "\c$\Windows"
            Else
                  strFolder = Replace(LCase(strFolder), "c:", "\\" & strDC & "\c$")
            End If
            strFile = strFolder & "\debug\netlogon.log"

            On Error Resume Next
            If objFileSystem.FileExists(strFile) Then
                  Set objFile = objFileSystem.GetFile(strFile)
                  objFile.Copy "NetLogon\" & strDC & "." & objFile.Name
                  Set objFile = Nothing
            End If
            On Error Goto 0
      
            Set colOS = Nothing
            Set      objWMIService = Nothing
      Next
End Sub

Sub ReadExpired
      Dim objFile, objStream
      Dim strLine, strNetworkAddress
      
      If objFileSystem.FileExists("Expired.txt") Then
            Set objFile = objFileSystem.GetFile("Expired.txt")
            Set objStream = objFile.OpenAsTextStream(1, 0)
            
            Do While Not objStream.AtEndOfStream
                  strLine = objStream.ReadLine
                  If InStr(strLine, "#") = 0 Then
                        strNetworkAddress = strLine
                        If Not objExpiredSubnets.Exists(strNetworkAddress) Then
                              objExpiredSubnets.Add strNetworkAddress, ""
                        End If
                  End If
            Loop
      End If
End Sub

Sub ParseLogs

      ' Checks through the Log Files

      Dim objFolder, objFile, objStream
      Dim strLine, strIP, strNetworkAddress, strServer, strHostName, strDate
      Dim intMaskLength
      Dim arrLine

      Set objFolder = objFileSystem.GetFolder("NetLogon")
      For Each objFile in objFolder.Files
            strServer = Replace(objFile.Name, ".Netlogon.log", "")
      
            Set objStream = objFile.OpenAsTextStream(1, 0)
            
            Do While Not objStream.AtEndOfStream
                  strLine = objStream.ReadLine
                  If InStr(strLine, "NO_CLIENT_SITE") Then
                        arrLine = Split(strLine, " ")
                        strDate = arrLine(0)
                        strHostName = arrLine(UBound(arrLine) - 1)
                        strIP = arrLine(UBound(arrLine))
                        
                        If Not objUnconfiguredIPs.Exists(strIP) Then
                              objUnconfiguredIPs.Add strIP, Array(strServer, strDate, strHostName)
                        End If
                        
                        If Left(strIP, 3) = "10." Then
                              intMaskLength = 18
                              strNetworkAddress = GetNetworkAddress(strIP, intMaskLength)
                              strNetworkAddress = strNetworkAddress & "\" & CStr(intMaskLength)
                        ElseIf Left(strIP, 8) = "192.168." Then
                              intMaskLength = 24
                              strNetworkAddress = GetNetworkAddress(strIP, intMaskLength)
                              strNetworkAddress = strNetworkAddress & "\" & CStr(intMaskLength)
                        End If
                        
                        If Not objUnconfiguredSubnets.Exists(strNetworkAddress) And _
                              Not objConfiguredSubnets.Exists(strNetworkAddress) And _
                              Not objExpiredSubnets.Exists(strNetworkAddress) Then
                                    objUnconfiguredSubnets.Add strNetworkAddress, strServer
                        End If
                  End If
            Loop
      Next
End Sub

'
' Reporting
'

Sub WriteReports

      Dim objFile
      Dim strIP, strSubnet

      If Not objFileSystem.FolderExists("Reports") Then
            objFileSystem.CreateFolder("Reports")
      End If

      Set objFile = objFileSystem.OpenTextFile("Reports\IPReport.csv", 2, True, 0)
      For Each strIP in objUnconfiguredIPs
            objFile.WriteLine strIP & "," & objUnconfiguredIPs(strIP)(0) &_
                  "," & objUnconfiguredIPs(strIP)(1) & "," & objUnconfiguredIPs(strIP)(2)
      Next
      Set objFile = Nothing
      
      Set objFile = objFileSystem.OpenTextFile("Reports\SubnetReport.csv", 2, True, 0)
      For Each strSubnet in objUnconfiguredSubnets
            objFile.WriteLine strSubnet & "," & objUnconfiguredSubnets(strSubnet)
      Next
      Set objFile = Nothing
End Sub

'
' Main Code
'

' Global Objects

Set objShell = CreateObject("WScript.Shell")
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objConfiguredSubnets = CreateObject("Scripting.Dictionary")
Set objExpiredSubnets = CreateObject("Scripting.Dictionary")
Set objUnconfiguredSubnets = CreateObject("Scripting.Dictionary")
Set objUnconfiguredIPs = CreateObject("Scripting.Dictionary")

arrDomainDNs = GetForestContexts
arrDomainNames = ConvertToDNS(arrDomainDNs)
SetSuffixes

For Each strDN in arrDomainDNs
      strDN = "OU=Domain Controllers," & strDN
      GetDCs strDN
Next

GatherLogs
ReSetSuffixes
GetConfiguredSubnets
ReadExpired
ParseLogs
WriteReports

Set objUnconfiguredIPs = Nothing
Set objUnconfiguredSubnets = Nothing
Set objExpiredSubnets = Nothing
Set objConfiguredSubnets = Nothing
Set objFileSystem = Nothing
Set objShell = Nothing
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 16900703

This is the version written to run for a single domain. Does pretty much the same thing as before.



' ScanNetlogon-DomainOnly.vbs
'
' Script to Read the Netlogon log files from %SystemRoot%\Debug\netlogon.log for all Domain
' Controllers in the Forest and work out which subnets are missing from AD Configuration.
'
' Author: Chris Dent
' Last Modified: 14/06/2006

Option Explicit

Const WBEM_RETURN_IMMEDIATELY = &H10
Const WBEM_FORWARD_ONLY = &H20

Dim objFileSystem, objShell, objUnconfiguredIPs, objUnconfiguredSubnets, objRootDSE
Dim objConfiguredSubnets
Dim strDN
Dim arrDCs()
Dim i

'
' Functions
'

Function GetNetworkAddress(strIP, intMaskLength)

      Dim strOctet, strBinOctet, strBinIP, strBinMask, strIPBit, strMaskBit
      Dim strBinNetwork, strNetworkAddress
      Dim i, intTemp, intOctet, intBit
      Dim arrOctets

      arrOctets = Split(strIP, ".")
      For Each strOctet in arrOctets
            intTemp  = 0
            strBinOctet = ""
            For i = 0 To 7
                  If intTemp + 2^(7 - i) <= CInt(strOctet) Then
                        strBinOctet = strBinOctet & "1"
                        intTemp = intTemp + 2^(7 - i)
                  Else
                        strBinOctet = strBinOctet & "0"
                  End If
            Next
            strBinIP = strBinIP & "." & strBinOctet
      Next
      strBinIP = Right(strBinIP, Len(strBinIP) - 1)

      For i = 1 to 32
            If i <= intMaskLength Then
                  strBinMask = strBinMask & "1"
            Else
                  strBinMask = strBinMask & "0"
            End If
            If i = 8 Or i = 16 Or i = 24 Then
                  strBinMask = strBinMask & "."
            End If
      Next

      For i = 1 to Len(strBinIP)
            strIPBit = Mid(strBinIP, i, 1)
            strMaskBit = Mid(strBinMask, i, 1)
            If strIPBit = "1" And strMaskBit = "1" Then
                  strBinNetwork = strBinNetwork & "1"
            ElseIf strIPBit = "." Then
                  strBinNetwork = strBinNetwork & strIPBit
            Else
                  strBinNetwork = strBinNetwork & "0"
            End If
      Next

      arrOctets = Split(strBinNetwork, ".")
      For Each strOctet in arrOctets
            intOctet = 0
            For i = 0 to 7
                  intBit = CInt(Mid(strOctet, i + 1, 1))
                  If intBit = 1 Then
                        intOctet = intOctet + 2^(7 - i)
                  End If
            Next
            strNetworkAddress = strNetworkAddress & "." & CStr(intOctet)
      Next
      GetNetworkAddress = Right(strNetworkAddress, Len(strNetworkAddress) - 1)
End Function

'
' AD Subroutines
'

Sub GetDCs(strDN)

      ' Gets the DNS Host Name for each Domain Controller

      Dim objOU, objDC

      On Error Resume Next
      Set objOU = GetObject("LDAP://" & strDN)
      For Each objDC in objOU
            If objDC.Class = "organizationalUnit" Then
                  GetDCs objDC.Get("distinguishedName")
            ElseIf objDC.Class = "computer" Then
                  ReDim Preserve arrDCs(i)
                  arrDCs(i) = objDC.Get("dNSHostName")
                  i = i + 1
            End If
      Next
      On Error Goto 0
End Sub

Sub GetConfiguredSubnets

      Dim objRootDSE, objSubnets, objSubnet
      Dim strSubnets, strNetworkAddress
      Dim arrTemp
      Dim intMaskLength

      Set objRootDSE = GetObject("LDAP://RootDSE")
      strSubnets = "CN=Subnets,CN=Sites," & objRootDSE.GEt("configurationNamingContext")
      Set objRootDSE = Nothing

      Set objSubnets = GetObject("LDAP://" & strSubnets)
      For Each objSubnet in objSubnets
            arrTemp = Split(objSubnet.Get("name"), "/")
            strNetworkAddress = arrTemp(0)
            intMaskLength = CInt(arrTemp(1))
            strNetworkAddress = strNetworkAddress & "\" & CStr(intMaskLength)

            If Not objConfiguredSubnets.Exists(strNetworkAddress) Then
                  objConfiguredSubnets.Add strNetworkAddress, ""
            End If
      Next
      Set objSubnets = Nothing
End Sub

'
' Data Gathering & Handling Subroutines
'

Sub GatherLogs

      ' Gather Files. Copy the files to a local repository for parsing, just easier that way.

      Dim objFolder, objFile, objWMIService, objItem
      Dim colOS
      Dim strDC, strFolder, strFile

      If Not objFileSystem.FolderExists("NetLogon") Then
            objFileSystem.CreateFolder("NetLogon")
      End If
      
      Set objFolder = objFileSystem.GetFolder("NetLogon")
      For Each objFile in objFolder.Files
            objFile.Delete
      Next
      Set objFolder = Nothing

      For Each strDC in arrDCs
            On Error Resume Next
      
            strFolder = ""
            Set objWMIService = GetObject("winmgmts:\\" & strDC & "\root\CIMV2")
            Set colOS = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
                        WBEM_RETURN_IMMEDIATELY + WBEM_FORWARD_ONLY)
                  
            For Each objItem in colOS
                  strFolder = objItem.WindowsDirectory
            Next
      
            On Error Goto 0

            If strFolder = "" Then
                  strFolder = "\\" & strDC & "\c$\Windows"
            Else
                  strFolder = Replace(LCase(strFolder), "c:", "\\" & strDC & "\c$")
            End If
            strFile = strFolder & "\debug\netlogon.log"

            If objFileSystem.FileExists(strFile) Then
                  Set objFile = objFileSystem.GetFile(strFile)
                  objFile.Copy "NetLogon\" & strDC & "." & objFile.Name
                  Set objFile = Nothing
            End If
      
            Set colOS = Nothing
            Set      objWMIService = Nothing
      Next
End Sub

Sub ParseLogs

      ' Checks through the Log Files

      Dim objFolder, objFile, objStream
      Dim strLine, strIP, strNetworkAddress, strServer, strHostName, strDate
      Dim intMaskLength
      Dim arrLine

      Set objFolder = objFileSystem.GetFolder("NetLogon")
      For Each objFile in objFolder.Files
            strServer = Replace(objFile.Name, ".Netlogon.log", "")
      
            Set objStream = objFile.OpenAsTextStream(1, 0)
            
            Do While Not objStream.AtEndOfStream
                  strLine = objStream.ReadLine
                  If InStr(strLine, "NO_CLIENT_SITE") Then
                        arrLine = Split(strLine, " ")
                        strDate = arrLine(0)
                        strHostName = arrLine(UBound(arrLine) - 1)
                        strIP = arrLine(UBound(arrLine))
                        
                        If Not objUnconfiguredIPs.Exists(strIP) Then
                              objUnconfiguredIPs.Add strIP, Array(strServer, strDate, strHostName)
                        End If
                        
                        If Left(strIP, 3) = "10." Then
                              intMaskLength = 18
                              strNetworkAddress = GetNetworkAddress(strIP, intMaskLength)
                              strNetworkAddress = strNetworkAddress & "\" & CStr(intMaskLength)
                        ElseIf Left(strIP, 8) = "192.168." Then
                              intMaskLength = 24
                              strNetworkAddress = GetNetworkAddress(strIP, intMaskLength)
                              strNetworkAddress = strNetworkAddress & "\" & CStr(intMaskLength)
                        End If
                        
                        If Not objUnconfiguredSubnets.Exists(strNetworkAddress) And _
                              Not objConfiguredSubnets.Exists(strNetworkAddress) Then
                                    objUnconfiguredSubnets.Add strNetworkAddress, strServer
                        End If
                  End If
            Loop
      Next
End Sub

'
' Reporting Subroutines
'

Sub WriteReports

      Dim objFile
      Dim strIP, strSubnet

      If Not objFileSystem.FolderExists("Reports") Then
            objFileSystem.CreateFolder("Reports")
      End If

      Set objFile = objFileSystem.OpenTextFile("Reports\IPReport.csv", 2, True, 0)
      For Each strIP in objUnconfiguredIPs
            objFile.WriteLine strIP & "," & objUnconfiguredIPs(strIP)(0) &_
                  "," & objUnconfiguredIPs(strIP)(1) & "," & objUnconfiguredIPs(strIP)(2)
      Next
      Set objFile = Nothing
      
      Set objFile = objFileSystem.OpenTextFile("Reports\SubnetReport.csv", 2, True, 0)
      For Each strSubnet in objUnconfiguredSubnets
            objFile.WriteLine strSubnet & "," & objUnconfiguredSubnets(strSubnet)
      Next
      Set objFile = Nothing
End Sub

'
' Main Code
'

Set objShell = CreateObject("WScript.Shell")
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objConfiguredSubnets = CreateObject("Scripting.Dictionary")
Set objUnconfiguredSubnets = CreateObject("Scripting.Dictionary")
Set objUnconfiguredIPs = CreateObject("Scripting.Dictionary")
Set objRootDSE = GetObject("LDAP://RootDSE")

strDN = "OU=Domain Controllers," & objRootDSE.Get("defaultNamingContext")

i = 0
GetDCs strDN

GatherLogs
GetConfiguredSubnets
ParseLogs
WriteReports

Set objRootDSE = Nothing
Set objUnconfiguredIPs = Nothing
Set objUnconfiguredSubnets = Nothing
Set objConfiguredSubnets = Nothing
Set objFileSystem = Nothing
Set objShell = Nothing
0
 
LVL 1

Author Comment

by:johndarby
ID: 16903643
Chris, thanks for the most excellent script. Out-of-the-box I decided to do a test run on my home domain and it spit back a message about compiling error...

D:\notes\netlogon.log-scan\ScanNetlogon.vbs(441, 14) Microsoft VBScript compilat
ion error: Expected end of statement

Do I need to turn on my vs.net debugger and start looking for problems or is this a simple issue?

Thank you for your kind help!

Warm regards,
John
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 70

Expert Comment

by:Chris Dent
ID: 16903670

Line 441 is out of range on mine, only 439 lines there... it's probably something really simple though - could you possibly post line 441 and a few lines on either side?

Sorry it's got errors in it... thought I had rid of all of them.

Chris
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 16903813

Hmm just out of curiousity, you didn't end up with both scripts in there did you? There are two seperate scripts above; one works for every DC in a forest... the other for every DC in a single domain. If you don't have a Forest then the second would be more appropriate.

Chris
0
 
LVL 1

Author Comment

by:johndarby
ID: 16904353
Chris...I grabbed the whole lot (two scripts) and wholesale plopped it into one file. My fault: I didn't read.

Okay, RTFM is still alive and well. I will try each script separately.

Thanks so much!
John
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 16904632

Phew, that makes a lot of sense :)

Chris
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now