11
ENTERPRISE
5.
Enter the following text to create the
UpdateComplete
function:
‘ ********** UPDATE COMPLETE? **********
‘ Checks for completed marker file. If it exists, the update has already run.
Function UpdateComplete
Set objFS = CreateObject(“Scripting.FileSystemObject”)
Set objFolder = objFS.GetFolder(strUNCPath)
Set objRE = new RegExp
objRE.Pattern = strMarkerCompleteFile
objRE.IgnoreCase = True
For Each objFile In objFolder.Files
If objRE.Test(objFile.Name) Then
UpdateComplete = True
Exit Function
End If
Next
UpdateComplete = False
End Function
The
UpdateComplete
function checks to see if a marker file has been created which signifies
the completion of the update. If this file exists, the function returns a value of
True
.
6.
Enter the following text to create the
UserPatchPrompt
function:
‘ ********** USER PATCH PROMPT **********
‘ Prompt the user whether they would like to run the updates at this time.
Function UserPatchPrompt
intAnswer
=
Msgbox(“An
update
has
been
detected.
Would
you
like
to
run
the
update
now?”
&
vbLF
&
_
“The update process will require several reboots!”, vbYesNo, “Update Detected”)
If intAnswer = vbYes Then
UserPatchPrompt = True
InsertMarker
Else
UserPatchPrompt = False
End If
End Function
The
UserPatchPrompt
function prompts the user with a
Yes
/
No
dialog. If the user selects
Yes
,
the patch runs and the function returns a value of
True
. If the user selects
No
, the function
return a value of
False
and the patch will not run.