Jump to content

grab the result code from a MSI install within a vbscript


Recommended Posts

Posted

hi

 

i use this script to install my software

 

Option Explicit

Dim strComputer, objNetwork, wshshell

Dim PCname

 

Set objNetwork = WScript.CreateObject("WScript.Network")

PCname = objNetwork.ComputerName

 

Set WshShell = WScript.CreateObject("WScript.Shell")

 

WshShell.Run "msiexec /i \\server\packages$\eset_client\esetclientwithconfigv2.msi /quiet /log \\server\packageinstalllogs$\" & PCname & "\eset_client.txt",0,True

 

WScript.Quit

 

using the /log switch built in to the msiexec i can get a log file telling me if it has worked or not but what i want to do is grab result code and echo the result any ideas how to do this

 

thank you

Posted

If all you want to do is echo the entire file output (rather than narrowing/searching)

 

Set objReadFile = objFSO.OpenTextFile("pathtofileblahblah", 1)
   strContents = objReadFile.ReadAll
   Wscript.Echo strContents
   objReadFile.Close

 

Or do you mean you want to bypass the file entirely?

 

Steve

Posted

hey

 

thank you but i have found what i cam looking for from

 

Windows System Error Codes (exit codes) Description | Symantec Connect Community

 

Dim oShell, MyApp, i

Set oShell = CreateObject("WScript.Shell")

 

MyApp = "msiexec /i \\server\software\mysql-5.5.15-winx64.msi /quiet /log \\server\software\mysql-5.5.15-winx64.txt"

 

i = 0

i = oShell.Run(MyApp, 1 ,True)

WScript.Echo "Exit Code is: " & (i)

Set oShell = Nothing

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...