Permalink
Switch branches/tags
Nothing to show
Find file Copy path
410 lines (325 sloc) 15.5 KB
<job id="Install-MicrosoftVisualC++x86x64">
<script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
<script language="VBScript">
'//----------------------------------------------------------------------------
'// Purpose: Used to install Microsoft Visual C++ Redistributable Packages
'//
'// Usage: cscript Install-MicrosoftVisualC++x86x64.wsf [/debug:true]
'// Version: 1.1 - August 8, 2012 - Johan Arwidmark
'// Version: 2.1 - June 26, 2014 - Mikael Nystrom
'// Version: 2.2 - March 12, 2017 - Johan Arwidmark
'// Version: 2.3 - April 18, 2017 - Henrik Bacher
'// Version: 2.4 - September 6, 2017 - Christoph Voigt
'// Version: 2.5 - October 4, 2018 - Johan Arwidmark
'//
'// Twitter: @jarwidmark
'// Blog : http://deploymentresearch.com
'//
'// Twitter: @mikael_nystrom
'// Blog : http://deploymentbunny.com
'//
'// Twitter: @Bacher
'// Blog : https://nosnik.dk/
'//
'// Twitter: @spucktier
'//
'// Disclaimer:
'// This script is provided "AS IS" with no warranties, confers no rights and
'// is not supported by the authors or Deployment Artist.
Option Explicit
Dim iRetVal
'On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0
'//---------------------------------------------------------------------------
'// Function: ZTIProcess()
'//---------------------------------------------------------------------------
Function ZTIProcess()
oLogging.CreateEntry oUtility.ScriptName & ": Starting installation", LogTypeInfo
'// Removed Visual C++ 2005 since it's no longer supported (and don't get security updates)
'Dim sSetupFile2005x86
'Dim sSetupFile2005x64
'//
'// Removed Visual C++ 2008 since it's no longer supported (and don't get security updates)
'Dim sSetupFile2008x86
'Dim sSetupFile2008x64
'//
Dim sSetupFile2010x86
Dim sSetupFile2010x64
Dim sSetupFile2012x86
Dim sSetupFile2012x64
Dim sSetupFile2013x86
Dim sSetupFile2013x64
'// Removed Visual C++ 2015 since it's replaced with 2017
'// (Visual C++ 2017 is a binary-compatible in-place upgrade of Visual C++ 2015)
'Dim sSetupFile2015x86
'Dim sSetupFile2015x64
'//
Dim sSetupFile2017x86
Dim sSetupFile2017x64
Dim sArguments
'// Disable Zone Checks
oEnv("SEE_MASK_NOZONECHECKS") = 1
'// Note: You need to create the below folder structure and downloading the various redistributable packages from Microsoft
'// https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
'// Removed Visual C++ 2005 since it's no longer supported (and don't get security updates)
'sSetupFile2005x86 = oUtility.ScriptDir & "\Source\VC2005\vcredist_x86.exe"
'sSetupFile2005x64 = oUtility.ScriptDir & "\Source\VC2005\vcredist_x64.exe"
'//
'// Removed Visual C++ 2008 since it's no longer supported (and don't get security updates)
'sSetupFile2008x86 = oUtility.ScriptDir & "\Source\VC2005\vcredist_x86.exe"
'sSetupFile2008x64 = oUtility.ScriptDir & "\Source\VC2005\vcredist_x64.exe"
'//
sSetupFile2010x86 = oUtility.ScriptDir & "\Source\VS2010\vcredist_x86.exe"
sSetupFile2010x64 = oUtility.ScriptDir & "\Source\VS2010\vcredist_x64.exe"
sSetupFile2012x86 = oUtility.ScriptDir & "\Source\VS2012\vcredist_x86.exe"
sSetupFile2012x64 = oUtility.ScriptDir & "\Source\VS2012\vcredist_x64.exe"
sSetupFile2013x86 = oUtility.ScriptDir & "\Source\VS2013\vcredist_x86.exe"
sSetupFile2013x64 = oUtility.ScriptDir & "\Source\VS2013\vcredist_x64.exe"
'// Removed Visual C++ 2015 since it's replaced with 2017
'sSetupFile2015x86 = oUtility.ScriptDir & "\Source\VS2015\mu_visual_cpp_2015_redistributable_update_3_x86_9052536.exe"
'sSetupFile2015x64 = oUtility.ScriptDir & "\Source\VS2015\mu_visual_cpp_2015_redistributable_update_3_x64_9052538.exe"
sSetupFile2017x86 = oUtility.ScriptDir & "\Source\VS2017\mu_visual_cpp_redistributable_for_visual_studio_2017_version_15.3_x86_11100229.exe"
sSetupFile2017x64 = oUtility.ScriptDir & "\Source\VS2017\mu_visual_cpp_redistributable_for_visual_studio_2017_version_15.3_x64_11100230.exe"
sArguments = "/Q"
'Checking for x86 files
'// Removed Visual C++ 2005 since it's no longer supported (and don't get security updates)
'If not oFSO.FileExists(sSetupFile2005x86) then
' oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2005x86 & " was not found, unable to install", LogTypeError
' ZTIProcess = Failure
' Exit Function
'End if
'//
'// Removed Visual C++ 2008 since it's no longer supported (and don't get security updates)
'If not oFSO.FileExists(sSetupFile2008x86) then
' oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2005x86 & " was not found, unable to install", LogTypeError
' ZTIProcess = Failure
' Exit Function
'End if
'//
If not oFSO.FileExists(sSetupFile2010x86) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2010x86 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if
If not oFSO.FileExists(sSetupFile2012x86) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2012x86 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if
If not oFSO.FileExists(sSetupFile2013x86) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2013x86 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if
'// Removed Visual C++ 2015 since it's replaced with 2017
'If not oFSO.FileExists(sSetupFile2015x86) then
' oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2015x86 & " was not found, unable to install", LogTypeError
' ZTIProcess = Failure
' Exit Function
'End if
If not oFSO.FileExists(sSetupFile2017x86) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2017x86 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if
' Installing x86 files
'// Removed Visual C++ 2005 since it's no longer supported (and does not receive security updates anymore)
'// Installing Visual C++ 2005 x86
' oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2005x86, LogTypeInfo
' iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2005x86 & """ " & sArguments)
' if (iRetVal = 0) or (iRetVal = 3010) then
' ZTIProcess = Success
'Else
' ZTIProcess = Failure
'End If
' oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
' oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'//
'// Removed Visual C++ 2008 since it's no longer supported (and does not receive security updates anymore)
'// Installing Visual C++ 2008 x86
' oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2008x86, LogTypeInfo
' iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2008x86 & """ " & sArguments)
' if (iRetVal = 0) or (iRetVal = 3010) then
' ZTIProcess = Success
'Else
' ZTIProcess = Failure
'End If
' oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
' oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'//
'// Installing Visual C++ 2010 x86
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2010x86, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2010x86 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
ZTIProcess = Failure
End If
oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Installing Visual C++ 2012 x86
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2012x86, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2012x86 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
ZTIProcess = Failure
End If
oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Installing Visual C++ 2013 x86
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2013x86, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2013x86 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
ZTIProcess = Failure
End If
oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Removed Visual C++ 2015 since it's replaced with 2017
'// Installing Visual C++ 2015 x86
'oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2015x86, LogTypeInfo
'iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2015x86 & """ " & sArguments)
'if (iRetVal = 0) or (iRetVal = 3010) then
' ZTIProcess = Success
'Else
' ZTIProcess = Failure
'End If
'oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
'oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Installing Visual C++ 2017 x86
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2017x86, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2017x86 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
ZTIProcess = Failure
End If
oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
' If x64 operating system, also install x64 version
If oEnvironment.Item("Architecture") = "X64" then
'Checking for x64 files
'// Removed Visual C++ 2005 since it's no longer supported (and does not receive security updates anymore)
'If not oFSO.FileExists(sSetupFile2005x64) then
' oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2005x64 & " was not found, unable to install", LogTypeError
' ZTIProcess = Failure
' Exit Function
'End if
'//
'// Removed Visual C++ 2008 since it's no longer supported (and does not receive security updates anymore)
'If not oFSO.FileExists(sSetupFile2008x64) then
' oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2008x64 & " was not found, unable to install", LogTypeError
' ZTIProcess = Failure
' Exit Function
'End if
'//
If not oFSO.FileExists(sSetupFile2010x64) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2010x64 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if
If not oFSO.FileExists(sSetupFile2012x64) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2012x64 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if
If not oFSO.FileExists(sSetupFile2013x64) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2013x64 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if
'// Removed Visual C++ 2015 since it's replaced with 2017
'If not oFSO.FileExists(sSetupFile2015x64) then
' oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2015x64 & " was not found, unable to install", LogTypeError
' ZTIProcess = Failure
' Exit Function
'End if
If not oFSO.FileExists(sSetupFile2017x64) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2017x64 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if
'Installing x64 files
'// Removed Visual C++ 2005 since it's no longer supported (and don't get security updates)
'// Installing Visual C++ 2005 x64
'oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2005x64, LogTypeInfo
'iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2005x64 & """ " & sArguments)
'if (iRetVal = 0) or (iRetVal = 3010) then
' ZTIProcess = Success
'Else
' ZTIProcess = Failure
'End If
'oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
'oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Removed Visual C++ 2008 since it's no longer supported (and don't get security updates)
'// Installing Visual C++ 2008 x64
'oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2008x64, LogTypeInfo
'iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2008x64 & """ " & sArguments)
'if (iRetVal = 0) or (iRetVal = 3010) then
' ZTIProcess = Success
'Else
' ZTIProcess = Failure
'End If
'oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
'oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Installing Visual C++ 2010 x64
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2010x64, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2010x64 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
ZTIProcess = Failure
End If
oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Installing Visual C++ 2012 x64
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2012x64, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2012x64 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
ZTIProcess = Failure
End If
oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Installing Visual C++ 2013 x64
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2013x64, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2013x64 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
ZTIProcess = Failure
End If
oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Removed Visual C++ 2015 since it's replaced with 2017
'// Installing Visual C++ 2015 x64
'oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2015x64, LogTypeInfo
'iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2015x64 & """ " & sArguments)
'if (iRetVal = 0) or (iRetVal = 3010) then
' ZTIProcess = Success
'Else
' ZTIProcess = Failure
'End If
'oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
'oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
'// Installing Visual C++ 20017x64
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2017x64, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2017x64 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
ZTIProcess = Failure
End If
oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
End If
'/// Enable Zone Checks
oEnv.Remove("SEE_MASK_NOZONECHECKS")
End Function
</script>
</job>