Ok, this is what I've come up with. The only bit that remains untested (as I've only just added it) is the creation of a log file during the CMW process. This is then the file that is subsequently checked for to see if running the CMW is necessary another time the script is run. This will hopefully allow me to keep the script as a semi-permanent startup script for any future changes to the Office installations.
Code:
'~~~~~~~~~~~~~~ Set Environment Variables ~~~~~~~~~~~~~~~~
Dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
strApp = "\\server\applications$\Office 2k3\MAINTWIZ.EXE"
strCfgFile = "\\server\applications$\Office 2k3\UpdateOutlook.CMW"
strLogFile = "C:\Program Files\Microsoft Office\CMW_Dec08.txt"
strTitle = "Office 2003 Custom Maintenance Wizard"
'~~~~~~~~~~~~~~ Check Previous Run State ~~~~~~~~~~~~~~~~~
If Not filesys.FileExists("C:\Program Files\Microsoft Office\CMW_Dec08.txt") Then
'~~~~~~~~~~~~~~ Run Command If Necessary ~~~~~~~~~~~~~~~~~
objShell.Run "%comspec% /c title " & strTitle & "|" & Chr(34) & strApp & Chr(34) & " /c " & Chr(34) & strCfgFile & Chr(34) & " /qb-" & " /l " & Chr(34) & strLogFile & Chr(34) ,,true
End If In case anyone else on here is wondering or needs it in the future, the code for adding a file (to use as the basis for checking) is here:
Code:
filesys.CreateTextFile "C:\Program Files\Microsoft Office\CMW_Dec08.txt", True
This is what I had before using the log file option.