Automatically updating the remote agents registry hive was a great idea. Just thought I would share the script for Windows 2000 AD that I use... All you have to do is replace the strDomain with your actual domain... Sub Main( ) '###################################################################### 'Declarations Dim strResult Dim strCN Dim strDomain Dim objShell Dim strLocalMachine '###################################################################### 'Define variables strDomain = "domain" '###################################################################### 'Get the local computername 'Each remote site's OU and server have the same name. 'I use this if I need to put it in the LDAP:// path Set objShell = CreateObject("WScript.Shell") strLocalMachine = objShell.ExpandEnvironmentStrings("%computername%") 'MsgBox strLocalMachine '###################################################################### 'Open root DSE do determine default naming context. 'This will bind to a specific server referenced strDomain defined above Set objRootDSE = GetObject("LDAP://" & strDomain & "/RootDSE") 'This will bind to any available DC (redundancy) 'Set objRootDSE = GetObject("LDAP://RootDSE") '###################################################################### 'Determine default naming context of the domain Dim strDefaultContext strDefaultContext = objRootDSE.Get("defaultNamingContext") 'MsgBox "Default Context is " & strDefaultContext Set objRootDSE = Nothing '###################################################################### 'Bind to the Computers container on the domain controller. Dim strContainer 'To bind to the computer container use the following: 'strContainer = "LDAP://" & strDomain & "/CN=computers," & strDefaultContext 'To bind to Domain Controllers container use the following: strContainer = "LDAP://OU=Domain Controllers," & strDefaultContext Set objContainer = GetObject(strContainer) ' objContainer.Filter = Array("user") '###################################################################### 'Scan all object names and place into registry for Master to use as Remote Agents Dim Sh Set Sh = CreateObject("Wscript.Shell") 'Sh.RegDelete ("HKLM\SOFTWARE\SoftTree Technologies, Inc.\24x7 Scheduler\3.0\Agents") For Each obj In objContainer strCN = obj.Name strCN = Right(strCN, Len(strCN) - 3) Sh.RegWrite "HKLM\SOFTWARE\SoftTree Technologies, Inc.\24x7 Scheduler\3.0\Agents\" & strCN & "."& strDomain & ".com" & "\Driver","Winsock" Sh.RegWrite "HKLM\SOFTWARE\SoftTree Technologies, Inc.\24x7 Scheduler\3.0\Agents\" & strCN & "."& strDomain & ".com" & "\Port","1096" Sh.RegWrite "HKLM\SOFTWARE\SoftTree Technologies, Inc.\24x7 Scheduler\3.0\Agents\" & strCN & "."& strDomain & ".com" & "\Location", strCN & "."& strDomain & ".com" Sh.RegWrite "HKLM\SOFTWARE\SoftTree Technologies, Inc.\24x7 Scheduler\3.0\Agents\" & strCN & "."& strDomain & ".com" & "\Options","" Sh.RegWrite "HKLM\SOFTWARE\SoftTree Technologies, Inc.\24x7 Scheduler\3.0\Agents\" & strCN & "."& strDomain & ".com" & "\TraceEnabled","N" Sh.RegWrite "HKLM\SOFTWARE\SoftTree Technologies, Inc.\24x7 Scheduler\3.0\Agents\" & strCN & "."& strDomain & ".com" & "\Async","Y" strResult = strResult & strCN & vbCrLf Next Set objContainer = Nothing '###################################################################### 'Write the strResult to d:\dc.txt 'strResult = "Domain Controllers found:" & vbCrLf & vbCrLf 'dim objFSO, objTextFile 'Const ForReading = 1, ForWriting = 2, ForAppending = 8 'Set objFSO = CreateObject("Scripting.FileSystemObject") 'Dim strDC 'strDC="d:\dc.txt" 'delete old file 'objfso.DeleteFile strDC, true 'write new file 'set objTextFile = objfso.CreateTextFile(strDC) 'objTextFile.Write strResult 'objTextFile.Close 'set objTextFile = nothing '###################################################################### End Sub : Yes, it is as simple as additing one key and several values to the registry : (for each agent). This needs to be done only once and it can be done in : the same vbscript. : Create one agent by hand and then use the registry editor to look up values : under the following key under : HKEY_LOCAL_MACHINE\SOFTWARE\SoftTree Technologies, Inc.\24x7 : Scheduler\3.0\Agents\[your agent hame here]
|