Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for VC++ 2022 #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

# Visual Studio
.vs/

# =========================
# Operating System Files
# =========================
Expand Down
222 changes: 49 additions & 173 deletions Tools/Install-X86-X64-C++/Install-MicrosoftVisualC++x86x64.wsf
Original file line number Diff line number Diff line change
@@ -1,257 +1,133 @@
<job id="Install-MicrosoftVisualC++x86x64">
<script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
<script language="VBScript">
<script language="VBScript">

'//----------------------------------------------------------------------------
'// Purpose: Used to install Microsoft Visual C++ Redistributable Packages
.// Latest info: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
.//
'// Usage: cscript Install-MicrosoftVisualC++x86x64.wsf [/debug:true]
.//
.// ChangeLog:
'// Version: 1.1 - August 8, 2012 - Johan Arwidmark
'// Version: 2.1 - June 26, 2014 - Mikael Nystrom
'// Version: 2.2 - Nov 14, 2015 - Mikael Nystrom
'// Version: 2.3 - Sep 27, 2017 - Mikael Nystrom
'// - Removed C++ 2005 and 2015
'// - Added C++ 2017
'// This script is provided "AS IS" with no warranties, confers no rights and
'// is not supported by the authors.
'// Version: 2.2 - November 14, 2015 - Mikael Nystrom
'// Version: 2.3 - September 27, 2017 - Mikael Nystrom
'// Version: 2.4 - April 15, 2023 - Pavel Andreev
'// - Removed C++ 2005-2012
'// - Added C++ 2015, 2017, 2019, 2022 (Universal package)
'//
'// This script is provided "AS IS" with no warranties, confers no rights and is not supported by the authors.
'//----------------------------------------------------------------------------

Option Explicit
Dim iRetVal
Option Explicit
Dim iRetVal

'On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0
On Error Goto 0

'//---------------------------------------------------------------------------
'// Function: ZTIProcess()
'//---------------------------------------------------------------------------
Function ZTIProcess()
Function ZTIProcess()

oLogging.CreateEntry oUtility.ScriptName & ": Starting installation", LogTypeInfo

Dim sSetupFile2008x86
Dim sSetupFile2008x64
Dim sSetupFile2010x86
Dim sSetupFile2010x64
Dim sSetupFile2012x86
Dim sSetupFile2012x64
Dim sSetupFile2013x86
Dim sSetupFile2013x64
Dim sSetupFile2017x86
Dim sSetupFile2017x64
Dim sSetupFile2022x86
Dim sSetupFile2022x64

Dim sArguments

'// Disable Zone Checks
oEnv("SEE_MASK_NOZONECHECKS") = 1
oEnv("SEE_MASK_NOZONECHECKS") = 1

sSetupFile2008x86 = oUtility.ScriptDir & "\Source\VS2008\vcredist_x86.exe"
sSetupFile2008x64 = oUtility.ScriptDir & "\Source\VS2008\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"
sSetupFile2017x86 = oUtility.ScriptDir & "\Source\VS2017\vc_redist.x86.exe"
sSetupFile2017x64 = oUtility.ScriptDir & "\Source\VS2017\vc_redist.x64.exe"
sSetupFile2022x86 = oUtility.ScriptDir & "\Source\VS2022\vc_redist.x86.exe"
sSetupFile2022x64 = oUtility.ScriptDir & "\Source\VS2022\vc_redist.x64.exe"
sArguments = "/Q"

'Checking for x86 files
If not oFSO.FileExists(sSetupFile2008x86) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2008x86 & " 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

'// Checking x86 distributives
If not oFSO.FileExists(sSetupFile2013x86) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2013x86 & " 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
If not oFSO.FileExists(sSetupFile2022x86) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2022x86 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if

'Installing x86 files
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

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

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

'// Install 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 = Success
Else
ZTIProcess = Failure
End If

oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo

oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2017x86, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2017x86 & """ " & sArguments)

'// Install 2022 x86
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2022x86, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2022x86 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
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
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 x64 operating system, also install x64 version
If oEnvironment.Item("Architecture") = "X64" then

'// Checking x86 distributives
If not oFSO.FileExists(sSetupFile2013x64) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2013x64 & " 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
If not oFSO.FileExists(sSetupFile2022x64) then
oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile2022x64 & " was not found, unable to install", LogTypeError
ZTIProcess = Failure
Exit Function
End if

'Installing x64 files
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

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

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

'// Install 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 = Success
Else
ZTIProcess = Failure
End If

oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo

oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2017x64, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2017x64 & """ " & sArguments)

'// Install 2022 x64
oLogging.CreateEntry oUtility.ScriptName & ": About to install " & sSetupFile2022x64, LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile2022x64 & """ " & sArguments)
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
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

End Function

</script>
</job>
</job>