FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!

vbs to silent install Adobe AIR 1.5.2




A vbscript do do a unattended install of Adobe AIR 1.5.2 software:

' Install package
'vbscript

On error resume next

Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set CurrentFolder = fso.GetFolder(".")
Set objEnviron = WshShell.Environment("PROCESS")
Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")

If CheckRunningFromDS() = True Then
strPackagePath = "\\halt1\express\Depot\Adobe AIR 1.5.2\1\"
Else
strPackagePath = CurrentFolder.Path & "\"
End If
strSucess = 0

If fso.FileExists("C:\Program Files\Common Files\Adobe AIR\Versions\1.0\Adobe AIR.dll") Then
strInstalledVersion = fso.GetFileVersion("C:\Program Files\Common Files\Adobe AIR\Versions\1.0\Adobe AIR.dll")
ErrorHandler "Current installed version == " & strInstalledVersion
End If

If strInstalledVersion = "1.5.0.7220" then
ErrorHandler "Starting DEINSTALL 1.5.0"
WshShell.Run "msiexec.exe /x """ & strPackagePath & "AdobeAIRInstaller15\setup.msi"" /qn ALLUSERS=2", , True
' Delete versionfile
If fso.FileExists("C:\Program Files\Common Files\Adobe AIR\Versions\Adobe Air Versionfile.exe") Then fso.DeleteFile "C:\Program Files\Common Files\Adobe AIR\Versions\Adobe Air Versionfile.exe",true End If
Else
ErrorHandler "No DEINSTALL of 1.5.0 needed"
End If

If strInstalledVersion = "1.5.1.8210" then
ErrorHandler "Er bestaat geen deinstall voor versie 1.5.1.8210, deinstalleer deze manueel"
End If

If fso.FileExists("C:\Program Files\Common Files\Adobe AIR\Versions\1.0\Adobe AIR.dll") Then
strInstalledVersion = fso.GetFileVersion("C:\Program Files\Common Files\Adobe AIR\Versions\1.0\Adobe AIR.dll")
ErrorHandler "Current installed version == " & strInstalledVersion
End If

If strInstalledVersion <> "1.5.2.8900" then
ErrorHandler "Starting installation"
WshShell.Run "msiexec.exe /i """ & strPackagePath & "AdobeAIRInstaller152\setup.msi"" /qn ALLUSERS=2", , True
' Copy versionfile
fso.copyFile strPackagePath & "Adobe Air Versionfile.exe","C:\Program Files\Common Files\Adobe AIR\Versions\Adobe Air Versionfile.exe"
Else
ErrorHandler "No installation of 1.5.2 needed"
End If

If Err.Number<>0 Then ErrorHandler "Adobe AIR 1.5.2 Undefined problem"
If strSucess = 0 Then ErrorHandler "Adobe AIR 1.5.2 Script Success" & vbCrLf Else ErrorHandler "Adobe AIR 1.5.2 Script Failed" & vbCrLf End If

Set WshShell = Nothing
Set objEnviron = Nothing
Set SystemSet = Nothing
Set fso = Nothing
Set CurrentFolder = Nothing

' ****************************************
' ErrorHandler() subroutine
' outputs error status and exits
' ****************************************
Sub ErrorHandler(strText)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
If not(fso.FolderExists("C:\Documenten")) Then
Set f = fso.CreateFolder("C:\Documenten")
End If
Set objOutputFile = fso.OpenTextFile("C:\Documenten\AltirisSoftwareInstall.log", ForAppending, TRUE) 'TRUE geeft hier aan dat de file gemaakt dient te worden indien deze niet bestaat
Dim strError

strError = Now & vbCrLf & "Running from: " & strPackagePath & vbCrLf & "Action: " & strText
If Err.Number<>0 Then
strSucess = 1
strError = strError & "0x" & Hex(Err.Number) & " - " & Err.Description
End If

Err.Number = 0 'Reset error number to capture next error correctly

objOutputFile.writeline strError
objOutputFile.close
End Sub

'======================
Function CheckRunningFromDS()
Set WshNetwork = WScript.CreateObject("WScript.Network")
sComputer = "%COMPNAME%"
If sComputer = WshNetwork.ComputerName Then
CheckRunningFromDS = True
Else
sComputer = "."
CheckRunningFromDS = False
End If
Set WshNetwork = Nothing
End Function
'======================



0 blog comments below




FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.