[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

NO_CLIENT_SITE entries in netlogon.log

Posted on 2006-06-13
7
Medium Priority
?
4,816 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 71

Accepted Solution

by:
Chris Dent earned 2000 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 71

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 71

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 71

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 71

Expert Comment

by:Chris Dent
ID: 16904632

Phew, that makes a lot of sense :)

Chris
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

649 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