' This script will enable the JET Database Performance Monitor (perfmon) counters for ' Active Directory. It can either be: ' 1) Run at time of Domain Controller build ' 2) Added as a Startup Script from the Domain Controllers Group Policy ' 3) Setup as a Scheduled Task ' Once this has been set open Performance Monitor (perfmon.exe) and you will see a ' Database object that contains many useful counters related to the JET Database. ' For Example: The Database Cache % Hit counter should be used to assess if the Domain ' Controller has enough memory. ' Note that you may see many articles referencing a "Squeaky Lobster" value instead ' of "Show Advanced Counters". There is quite a bit of history around the "Squeaky ' Lobster" value, but it is being phased out in favour of the "Show Advanced Counters" ' value. ' This script will backup the existing perf counts to a file called PerfCounterBackup.ini ' located in the %SystemRoot%\debug folder. ' Release 1.0 ' Written by Jeremy@jhouseconsulting.com 25th September 2012. Option Explicit Dim objShell, strSystemRoot, strKey, strJETperfcounterLocation, strCommandLine Set objShell = WScript.CreateObject("WScript.Shell") strSystemRoot = objShell.ExpandEnvironmentStrings("%SystemRoot%") strKey = "HKLM\system\currentcontrolset\Services\ESENT\Performance" ' JET perf counters objShell.RegWrite strKey & "\Open", "OpenPerformanceData", "REG_SZ" objShell.RegWrite strKey & "\Collect", "CollectPerformanceData", "REG_SZ" objShell.RegWrite strKey & "\Close", "ClosePerformanceData", "REG_SZ" objShell.RegWrite strKey & "\Library", strSystemRoot & "\system32\esentprf.dll", "REG_SZ" objShell.RegWrite strKey & "\Show Advanced Counters", 1, "REG_DWORD" ' Set JET perf counter file location If CInt(OSVersion()) >= 6 Then strJETperfcounterLocation = strSystemRoot & "\inf\ESENT\0000\esentprf.ini" Else strJETperfcounterLocation = strSystemRoot & "\System32\esentprf.ini" End If ' Backup Perfmon Counters strCommandLine = "%comspec% /c lodctr.exe /s:" & strSystemRoot & "\debug\PerfCounterBackup.ini" objShell.Run strCommandLine ' Import Jet perf counters strCommandLine = "%comspec% /c lodctr.exe " & strJETperfcounterLocation objShell.Run strCommandLine Set objShell = Nothing wscript.quit(0) Function OSVersion() Dim strComputer, oWMIService, colOSInfo, oOSProperty, strVersion strComputer = "." Set oWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colOSInfo = oWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48) For Each oOSProperty in colOSInfo strVersion = Left(oOSProperty.Version,3) Next OSVersion = strVersion Set oWMIService = Nothing Set colOSInfo = Nothing End Function