0
votes

I've made a small logon script, which has a task of installing a Mimecast Add-in for Outlook.

The script first check is the plugin dll file exist and if it does it the takes product version. If the version matches our current 8.7.4425.0 addin then it executes a silent installation of the msi.If the addin dll doesn't exist installation executes as well.

I use VBSEdit to build my scripts and this one runs perfectly from debugger. It finds add-in version and executes the msi.

However, when I execute the script using cscript or double-click from windows Explorer I get compilation error.

for diagnostic purposes I'm using /qb switch to see msi execute.

The code is below.

Dim mimever 
Dim instcmd 
Dim exist 
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.shell")
exist = 0
instcmd = "cmd /c start /wait msiexec /i " & Chr(34) & "\\server-01\ict\Software\Mimecast\MSO 7.4\Mimecast for Outlook 7.4.2183.20730 (64 bit).msi" & Chr(34) & " ALLUSERS=1" & " /qb /norestart"

if objFSO.FileExists("C:\Program Files\Mimecast\Mimecast Outlook Add-In\adxloader64.dll") then
    exist = 1
End if

If exist = 1 then
    mimever = objFSO.GetFileVersion("C:\Program Files\Mimecast\Mimecast Outlook Add-In\adxloader64.dll") 
        if mimever = null then 
            mimever = 0
        End if
End if

if mimever <> "8.7.4425.0" Or exist = 0 then
    ObjShell.Run instcmd
End If

Error screenshot

1
It looks to me like you are running the Debugger with admin rights but the cscript runs without admin rights (UAC). I didn't test this on my side yet but I reckon that will most likely be the reason. - RealSollyM
The longest line is 199 characters in the provided code snippet, hence the error (Line 13, Char 214) does not relate it. In any case, I'd try instcmd = "cmd /c start """" /wait msiexec /i " & … - JosefZ
SollyM, elevation also returns the same error but thank you. JosefZ, I've tried adding the extra characters but error remains. - Bart Rosinski
The line on error screenshot is not actual, please check the code you posted. - omegastripes
Hi All, Just want to say that I have run the script again this morning I'm no longer getting the error and msi executes fine. The code includes the addition of """" characters JosefZ has suggested, thank you for helping finding the fix. - Bart Rosinski

1 Answers

0
votes

The fix was to change instcmd variable line to :

instcmd = "cmd /c start """" /wait msiexec /i " & Chr(34) & "\\server-01\ict\Software\Mimecast\MSO 7.4\Mimecast for Outlook 7.4.2183.20730 (64 bit).msi" & Chr(34) & " ALLUSERS=1" & " /qb /norestart"