Garrett
Garrett

Reputation: 155

VBscript 800a0414 error and scripting install updates

I am fairly new to vbs and i am writing a script that checks what version of a program is installed and update it if necessary. I have the updates in a folder and it checks (or should) the kbnumber and the title to make sure its the correct update.

I keep getting error code 800a0414 on the following line, and i have looked everywhere and tried many ways of placing the parentheses, taking them away or using call.

Else InStr(1, update.title, "Internet Explorer 8", vbtextcompare) > 0 Then
        Installed = installHotFix(ie9RegExp)

Also here if you could look at this and help me with it, I can't tell if it will work since the compiler gets stuck on the above issue. I dont want to flood the site with another question once the 800a0414 is resolved. I thank you in advance.

Set ie7RegExp = "^IE7.*strKBNumber.*"
Set ie8RegExp = "^IE8.*strKBNumber.*"
Set ie9RegExp = "^IE9.*strKBNumber.*"

If InStr(1, update.title, "Internet Explorer", vbtextcompare) > 0 Then
    If InStr(1, update.title, "Internet Explorer 6", vbtextcompare) > 0 Then
            Installed = installHotFix(ie7RegExp)
            myRegExp = ie7RegExp

    ElseIf InStr(1, update.title, "Internet Explorer 7", vbtextcompare) > 0 Then
            Installed = installHotFix(ie8RegExp)
            myRegExp = ie8RegExp

    Else InStr(1, update.title, "Internet Explorer 8", vbtextcompare) > 0 Then
            Installed = installHotFix(ie9RegExp)
            myRegExp = ie9RegExp

Function installKB(strKBNumber)

Dim myRegExp

myRegExp.IgnoreCase = True
myRegExp.Pattern = strKBNumber
installHotFix(myRegExp)

End Function

Function installHotFix(objRegExp)

Dim result
Dim hotfixDir

installKB = false

For each hotfixdir in arrHotfixlocations
    if objFSO.FolderExists(hotfixDir) Then
        result = SearchForHotfixes(objRegExp, hotfixDir)
        if result = True Then
            installKB = True
        End If
    End If
Next
End Function

Function SearchForHotfixes(objRegExp, strFolderName)
Dim file
Dim subFolder
dim result

SearchForHotfixes = false

For Each file in objFSO.GetFolder(strFolderName).Files
   If objRegExp.Test(file.name) Then
        installUpdate(file)
        SearchForHotfixes = true
   End If
Next

For Each subFolder in objFSO.GetFolder(strFolderName).subFolders
    result = SearchForHotfixes(objRegExp, subFolder)
    If result = true then
        SearchForHotfixes = true
    End If
Next

End Function

This is just the parts i have changed, before i added the above the old script worked. So if you require more code or a better explanation to help me please ask, but i believe this is all.

Upvotes: 0

Views: 815

Answers (1)

Alex K.
Alex K.

Reputation: 175926

Else InStr(...

Should be ElseIf as you subsequently have a logical test: InStr(1, update.title, "Internet Explorer 8", vbtextcompare) > 0.

If you want a fall-through for anything that's not been matched with a prior elseif you need

Else
    Installed = installHotFix(ie9RegExp)
    myRegExp = ie9RegExp

Upvotes: 1

Related Questions