Listing 1: Code That Prepares for the Backup and Copy Operations ' ******* BEGIN CALLOUT A ******* Set objNetwork = CreateObject("WScript.Network") ThisComputer = objNetwork.ComputerName EventLogBackupDir = "c:\EventLogBackups\" Dest = "\\" & ThisComputer & "\c$\EventLogCollectionFolder\" TransactionLogDir = "\\" & ThisComputer & "\c$\EventLogCollectionFolder\" ' ******* END CALLOUT A ******* StartTimer = Now() xTime = cstr(time) xtime = "_" & Replace(xtime,":","_") xtime = Replace(xtime," ","") timestamper = Trim(cstr(month(Now()))) & "_" & Trim(cstr(day(Now()))) & _ "_" & Trim(cstr(year(Now()))) & Trim(xtime) Set fso = CreateObject("Scripting.FileSystemObject") ' Create the transaction log folder if it doesn't exist. If Not fso.FolderExists(TransactionLogDir) Then Set Transfolder = fso.CreateFolder(TransactionLogDir) End If ' Create the transaction log and write the date to it. strFilePath = TransactionLogDir & "EventLogCollection_" & timestamper & ".log" Set objFile = CreateObject("Scripting.FileSystemObject") Set TransactionLog = objFile.CreateTextFile(strFilePath,True) TransactionLog.WriteLine("~StartTime: " & StartTimer) ' Create the destination folder on the collection server if it doesn't exist. If Not fso.FolderExists(Dest) Then Set Destfolder = fso.CreateFolder(Dest) End If If Err.Number <> 0 Then TransactionLog.WriteLine("DESTINATION ERROR. Check this " & _ "Destination for accuracy ==>" & Dest) Err.Clear End If ' Connect to AD. Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCommand.ActiveConnection = objConnection objCommand.Properties("Page Size") = 100 objCommand.Properties("Sort On") = "CN" objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE ' ******* BEGIN CALLOUT B ******* ' Replace the ADsPath below with the appropriate ADsPath (i.e., the ' string that starts with LDAP). objCommand.CommandText = _ "SELECT cn FROM & 'LDAP://CN=Computers,DC=TestLab,DC=com'" ' ******* END CALLOUT B ******* Set objRecordSet = objCommand.Execute ' Check for incorrect or non-existent ADsPath. If Err.Number <> 0 Then TransactionLog.WriteLine("Script ERROR. Check Select Statement " & _ "and ADSPath for accuracy. Source of Error==>" & Err.Source & _ ". Error Description==>" & Err.Description) TransactionLog.WriteLine("Script Terminated.") WScript.Quit End If '*** objRecordSet.MoveFirst