' Listing 2: The RuntheScript Subroutine Private Sub RuntheScript(strInputFile, arrExServers) Dim strStartTime, strFNDate, strDomain, outFileName1 Dim outFileName2, outFileName3, outFileName4 Dim arrServerList, strInRec, strElapsedTime, strRunTime ' ******* BEGIN CALLOUT A ******* ' Get the start time. strStartTime = Now ' Get the current date for the output log files' names. strFNDate = fnDate(Date) ' Get DNS domain name from the current domain for the output log files. strDomain = getDNSDomain() ' ******* END CALLOUT A ******* ' ******* BEGIN CALLOUT B ******* ' Set the names of the output log files. outFileName1 = strDomain & "_Error_Servers_" & strFNDate & ".xls" outFileName2 = strDomain & "_" & strMainReport & "_Servers_" & _ strFNDate & ".xls" outFileName3 = strDomain & "_Offline_Servers_" & strFNDate & ".xls" outFileName4 = strDomain & "_Unknown_Servers_" & strFNDate & ".xls" ' ******* END CALLOUT B ******* ' ******* BEGIN CALLOUT C ******* If Len(strInputFile) > 0 Then ' Read the server list from the input file if it's provided. PrintMsg2 "Processing servers from the input file " & strInputFile & "." ' Read the server list into the array. arrServerList = getServerList(strInputFile, strInRec) ' Check to see whether the input file contains any records. If strInRec < 1 Then ShowUsageRec(strInputFile) WScript.Quit End If ' ******* END CALLOUT C ******* ' ******* BEGIN CALLOUT D ******* Else ' Get the server list from AD. arrServerList = getADServerList(strFNDate) PrintMsg1 "Processing servers from the Active Directory of " & _ strDomain & " domain." End If ' ******* END CALLOUT D ******* ' ******* BEGIN CALLOUT E ******* ' Process the servers in arrServerList. ProcessServers strInputFile, arrServerList, arrExServers, _ outFileName1, outFileName2, outFileName3, outFileName4 ' ******* END CALLOUT E ******* ' Calculate the elapsed time and display the finish message. strElapsedTime = DateDiff("s",strStartTime,Now) strRunTime = convertTime(strElapsedTime) PrintMsg4 "******** The " & strProgram & " has finished ********" PrintMsg4 "The " & strProgram & " run time is: " & strRunTime & "." ' Below is a subroutine to display a finish message in a pop-up ' dialog box. Remove the rem character to allow this dialog box. ' ShowFinish strRunTime End Sub