Listing 1: Office2007_Deploy.vbs Option Explicit ' BEGIN CONFIGURATION BLOCK ' DOMAIN Dim sDomainDNS, sDomainDN sDomainDNS = "windomain.com" sDomainDN = "dc=windomain,dc=com" ' DATABASE DEFINITION: where our script will find its data store ' The database is used to log the results of the script ' Because systems don't yet have Office 2007, ' use a downlevel database format (xls/mdb) Dim sFile, sTable sFile = "\\server01.windomain.com\configmgt\SystemConfigurationDB.xls" sTable = "Sheet1" ' Name of Excel sheet or Access table Dim sComputerNameField, sActionField, sStatusField, sDateField, sNotesField ' Data table (e.g. Excel worksheet) consists of fields/columns ' labeled as defined below. ' The items on the right side of the equal sign ' should be the labels in the first row of the worksheet sComputerNameField = "ComputerName" sActionField = "Action" sStatusField = "Status" sDateField = "Date" sNotesField = "Notes" Dim sCommand ' COMMAND to run Office 2007 installation sCommand = "\\windomain.com\software\office\setup.exe" Dim sAction ' ACTION that will be logged in the ACTION column of the log sAction = "Office 2007 Deployment" Dim sStagingGroup, sSuccessGroup, sErrorGroup ' GROUPS that manage this change ' Important: These groups must have the access control entry ' SELF::Allow::Write::Members ' Group that computer/user is in BEFORE this script is run sStagingGroup = "CCM_Office 2007 Deploy" ' Group that this computer/user is moved to based on success sSuccessGroup = "APP_Office 2007" sErrorGroup = "ALERT_Office 2007 Deploy" ' END CONFIGURATION BLOCK ' Data ADO enums Const adStateClosed = 0 Const adOpenStatic = 3 Const adOpenDynamic = 2 Const adLockOptimistic = 3 Const adUseClient = 3 Dim retVal ' Perform logic to translate configuration to data table identity Dim sFileType Dim MSOfficeVersion Call ADO_IdentifyDataType (sFile, sFileType, MSOfficeVersion) ' Initialization Dim sComputerName sComputerName = GetComputerName() Dim oShell Set oShell = CreateObject("WScript.Shell") Dim sScriptResults ' BEGIN CALLOUT A ' Run the command Dim iExitCode, sStdOut, sStdErr Call ExecuteCommand(sCommand, iExitCode, sStdOut, sStdErr) ' Interpret the results Dim sStatus, sNotes Select Case iExitCode Case 0 sStatus = "SUCCESS" sNotes = "" Case Else sStatus = "ERROR" sNotes = iExitCode & ": " & sStdErr End Select ' In case there are problems logging, keep going On Error Resume Next Call Log_WriteCommandResults(sComputerName, sStatus, sNotes) ' END CALLOUT A ' BEGIN CALLOUT B ' Modify groups to reflect results Select Case sStatus Case "SUCCESS" retVal= Group_AddMember (sSuccessGroup, sComputerName, & _ "computer") Case "ERROR" retVal = Group_AddMember (sErrorGroup, sComputerName, & _ "computer") End Select retVal = Group_RemoveMember (sStagingGroup, sComputerName, "computer") ' END CALLOUT B