Knowledge Base FAQ Item #6600132
Q6600132: I want to modify the CONFIG.SDF configuration database file using a VBScript. Is this possible?
Yes, you can. All checks and folders are stored in the 'Nodes' table of the CONFIG.SDF configuration file.
The following VBScript counts the number of folders and checks, shows all the checks and updates the displayname of one of the checks. Run it from the commandline using the command CSCRIPT <file.vbs>:
Option Explicit Const CONFIGDBPATH = "C:\ProgramData\ActiveXperts\Network Monitor\Configuration\Config.sdf" Dim objConn, strQuery, RS Set objConn = CreateObject( "ADODB.Connection" ) objConn.Open "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;SSCE:Max Database Size=4000;Data Source=" & CONFIGDBPATH & ";" ' Count the number of Checks and Folders (ID's start at 10, lower IDs are system IDs) strQuery = "SELECT Count(*) as cnt FROM Nodes WHERE ID>=10" Set RS = objConn.Execute( strQuery ) WScript.Echo "Number of Nodes: " & RS( "cnt" ) ' Print Checks and Folders (ID's start at 10, lower IDs are system IDs) strQuery = "SELECT * FROM Nodes WHERE ID>= 10 ORDER BY ID" Set RS = objConn.Execute( strQuery ) While Not RS.EOF PrintNode( RS ) RS.MoveNext WEnd ' Update DisplayName of Checkwith ID=10000 (if exists_ strQuery = "UPDATE Nodes SET DisplayName='My new name' WHERE ID=13362" Set RS = objConn.Execute( strQuery ) objConn.Close Set objConn = Nothing Sub PrintNode( RS ) WScript.Echo "Node #" & RS( "ID" ) WScript.Echo " DisplayName: " & RS( "DisplayName" ) WScript.Echo " ScanType: " & RS( "ScanType" ) WScript.Echo " ScanInterval: " & RS( "ScanInterval" ) WScript.Echo " ScanSchedule: " & RS( "ScanSchedule" ) WScript.Echo " ErrorTreshold: " & RS( "ErrorTreshold" ) WScript.Echo " OnHold: " & RS( "OnHold" ) WScript.Echo " InverseResult: " & RS( "InverseResult" ) WScript.Echo " TimeOut: " & RS( "TimeOut" ) WScript.Echo " Type: " & RS( "Type" ) WScript.Echo " DependencyList: " & RS( "DependencyList" ) WScript.Echo " Comments: " & RS( "Comments" ) WScript.Echo " MaintenanceServer: " & RS( "MaintenanceServer" ) WScript.Echo " MaintenanceList: " & RS( "MaintenanceList" ) WScript.Echo " NotifyMultiple: " & RS( "NotifyMultiple" ) WScript.Echo " NotifyMinutes: " & RS( "NotifyMinutes" ) WScript.Echo " NotifyFlags: " & RS( "NotifyFlags" ) WScript.Echo " NotifyMailOffline: " & RS( "NotifyMailOffline" ) WScript.Echo " NotifyMailOnline: " & RS( "NotifyMailOnline" ) WScript.Echo " NotifyNetworkOffline: " & RS( "NotifyNetworkOffline" ) WScript.Echo " NotifyNetworkOnline: " & RS( "NotifyNetworkOnline" ) WScript.Echo " NotifySmsOffline: " & RS( "NotifySmsOffline" ) WScript.Echo " NotifySmsOnline: " & RS( "NotifySmsOnline" ) WScript.Echo " NotifyPagerOffline: " & RS( "NotifyPagerOffline" ) WScript.Echo " NotifyPagerOnline: " & RS( "NotifyPagerOnline" ) WScript.Echo " NotifySnmpTrapOffline: " & RS( "NotifySnmpTrapOffline" ) WScript.Echo " NotifySnmpTrapOnline: " & RS( "NotifySnmpTrapOnline" ) WScript.Echo " RunMultiple: " & RS( "RunMultiple" ) WScript.Echo " RunMinutes: " & RS( "RunMinutes" ) WScript.Echo " RunFlags: " & RS( "RunFlags" ) WScript.Echo " RunExeOffline: " & RS( "RunExeOffline" ) WScript.Echo " RunExeOnline: " & RS( "RunExeOnline" ) WScript.Echo " RunVbsOffline: " & RS( "RunVbsOffline" ) WScript.Echo " RunVbsOnline: " & RS( "RunVbsOnline" ) WScript.Echo " RestartService: " & RS( "RestartService" ) WScript.Echo " RestartServer: " & RS( "RestartServer" ) WScript.Echo " RestartServerEntry: " & RS( "RestartServerEntry" ) WScript.Echo " Uncertain: " & RS( "Uncertain" ) WScript.Echo " Graph: " & RS( "Graph" ) WScript.Echo " WindowsLoginUseServerEntry: " & RS( "WindowsLoginUseServerEntry" ) WScript.Echo " WindowsLoginServerEntry: " & RS( "WindowsLoginServerEntry" ) WScript.Echo " CheckHasLogin1: " & RS( "CheckHasLogin1" ) WScript.Echo " CheckHasLogin2: " & RS( "CheckHasLogin2" ) WScript.Echo " CheckLoginName1: " & RS( "CheckLoginName1" ) WScript.Echo " CheckLoginName2: " & RS( "CheckLoginName2" ) WScript.Echo " CheckLoginEPassword1: " & RS( "CheckLoginEPassword1" ) WScript.Echo " CheckLoginEPassword2: " & RS( "CheckLoginEPassword2" ) WScript.Echo " CheckFlags: " & RS( "CheckFlags" ) WScript.Echo " CheckServer: " & RS( "CheckServer" ) WScript.Echo " CheckParam1: " & RS( "CheckParam1" ) WScript.Echo " CheckParam2: " & RS( "CheckParam2" ) WScript.Echo " CheckParam3: " & RS( "CheckParam3" ) WScript.Echo " CheckParam4: " & RS( "CheckParam4" ) WScript.Echo " CheckParam5: " & RS( "CheckParam5" ) WScript.Echo " CheckParam6: " & RS( "CheckParam6" ) WScript.Echo " CheckParam7: " & RS( "CheckParam7" ) WScript.Echo " CheckParam8: " & RS( "CheckParam8" ) WScript.Echo " CheckParam9: " & RS( "CheckParam9" ) WScript.Echo " CheckParam10: " & RS( "CheckParam10" ) End Sub(viewed: 646)