EDN Admin
Well-known member
I want to create a vbscript to install multiple msis
When just launching the msis shortly after each other I get installation issues, probably because the installer cant start a new installation before the current installation is finisched.
It seems to work with the solution below.<br/>
After launching an msi installation the routine waits until the install is finished<br/>
<pre class="prettyprint lang-vb Option Explicit
Dim sStatus
Dim sString
sString = "MsiExec.exe /i" & " \ServerFoldersetupfile.msi" & " /qn" & " /norestart" & " /log d:msi_install.log"
InstallMSI sString
Sub installMSI(sInstallString)
install MSI packet and wait for install to finish
initialise
Dim i1 simple int counter
Dim oShell
Dim oExec
start install
Set oShell = CreateObject("WScript.Shell")
sStatus = sStatus & "installing: " & sInstallString & vbCRLF & "start: " & Now() & vbCrLF
Set oExec = oShell.Exec(sInstallString)
i1 = 0
Do Until (oExec.Status = 1 or i1 > 60)
WScript.Sleep 10000
i1 = i1 + 1
Loop
If oExec.Status <> 1 Then sStatus = sStatus & "Error: could not install fast enough " & vbCRLF install took over 600 seconds
sStatus = sStatus & "finisched: " & Now() & " "
clean up
Set oShell = Nothing
Set oExec = Nothing
End Sub installMSI[/code]
<br/>
I hoped their would be a solution based on direct interaction with the microsoft installer
Something like...
<pre class="prettyprint lang-vb sStatus = sStatus & "installing software "
Set oInstall = CreateObject("WindowsInstaller.Installer")
oInstall.UILevel = 2 no UI
oInstall.InstallProduct "\serverfolderSetup.msi", ""
Do Until (oInstall.Status = finished)
WScript.Sleep 1000
Loop
sStatus = sStatus & "finished install" <br/>msgbox sStatus
[/code]
oInstall.Status is no valid code.
Does anybody know a good solution to control the windows installer object directly from vbscript??
All help is welcome!!
<br/>
View the full article
When just launching the msis shortly after each other I get installation issues, probably because the installer cant start a new installation before the current installation is finisched.
It seems to work with the solution below.<br/>
After launching an msi installation the routine waits until the install is finished<br/>
<pre class="prettyprint lang-vb Option Explicit
Dim sStatus
Dim sString
sString = "MsiExec.exe /i" & " \ServerFoldersetupfile.msi" & " /qn" & " /norestart" & " /log d:msi_install.log"
InstallMSI sString
Sub installMSI(sInstallString)
install MSI packet and wait for install to finish
initialise
Dim i1 simple int counter
Dim oShell
Dim oExec
start install
Set oShell = CreateObject("WScript.Shell")
sStatus = sStatus & "installing: " & sInstallString & vbCRLF & "start: " & Now() & vbCrLF
Set oExec = oShell.Exec(sInstallString)
i1 = 0
Do Until (oExec.Status = 1 or i1 > 60)
WScript.Sleep 10000
i1 = i1 + 1
Loop
If oExec.Status <> 1 Then sStatus = sStatus & "Error: could not install fast enough " & vbCRLF install took over 600 seconds
sStatus = sStatus & "finisched: " & Now() & " "
clean up
Set oShell = Nothing
Set oExec = Nothing
End Sub installMSI[/code]
<br/>
I hoped their would be a solution based on direct interaction with the microsoft installer
Something like...
<pre class="prettyprint lang-vb sStatus = sStatus & "installing software "
Set oInstall = CreateObject("WindowsInstaller.Installer")
oInstall.UILevel = 2 no UI
oInstall.InstallProduct "\serverfolderSetup.msi", ""
Do Until (oInstall.Status = finished)
WScript.Sleep 1000
Loop
sStatus = sStatus & "finished install" <br/>msgbox sStatus
[/code]
oInstall.Status is no valid code.
Does anybody know a good solution to control the windows installer object directly from vbscript??
All help is welcome!!
<br/>
View the full article