Update:
This scripts has been updated/modified:
– Installation of VC++ 2005 and 2015 has been removed
– Installation of VC++ 2017 has been added
The script has also been moved to GitHub
During todays session at The Ultimate Event I did a demo of a VBscript Wrapper that install all VC++ runtimes. Mr “Someone” asked if it was published and I said yes, I was wrong so here it is.
The Script
The script will install all versions of VC++ on 32 and 64 bit machines as an application in a task sequence, that way you don’t need to have one application for each VC++ application.
Download the script from here https://github.com/DeploymentBunny/Files/tree/master/Tools/Install-X86-X64-C%2B%2B
(it used to be on my Onedrive, now on Github)
The Task Sequence
After you have added the application in the MDT workbench, add the application to the Workbench like this:
The Application
When importing the application it should look like this:
The folder
The folder needs to have all the VC++ files organized in a folder structure that looks like this:
You can use the script in the following folder to download all files in the correct folder structure. Check this blog post:https://deploymentbunny.com/2014/08/05/powershell-is-king-download-all-vc-runtimes-using-a-script/
/mike
Categories: MDT, OS Deployment, OSD, Reference Image
Excellent! I take it that it’s not going to be hard to adapt it for other tedious installations, also?
Yep, just change the .exe’s and the cmdline
Hi,
To share some knowledge, I create this
[cid:image001.png@01CFD8BE.D35BD330]
And use this script in a package
‘==========================================================================
‘
‘ ‘
‘ NAME: SCCM_install.vbs
‘
‘ AUTHOR: Maarten van WIlligen
‘ DATE : 24-7-2014
‘
‘ COMMENT:
‘ Install Visual C++ releases x86/x64
‘ Microsoft Visual C++ 2005
‘ Microsoft Visual C++ 2008
‘ Microsoft Visual C++ 2010
‘ Microsoft Visual C++ 2012
‘ Microsoft Visual C++ 2013
‘ Structuur:
‘ Folder
‘ Sccm_install.vbs
‘ X64
‘ X86
‘
‘ Version: 1.0.1
‘
‘==========================================================================
Dim isCScript
Dim isWScript
Dim Subfolder
Dim sElement ,strCommand, OptionsExec, RC
Dim RegEx
Set RegEx = New RegExp
RegEx.IgnoreCase = True
RegEx.Global=True
Set dicFileName = CreateObject(“Scripting.Dictionary”)
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objShell=CreateObject(“WScript.Shell”)
OptionsExec = “/q”
sScriptDir = objFSO.GetParentFolderName(WScript.ScriptFullName)
Set objFolder = objFSO.GetFolder(sScriptDir)
Set colFiles = objFolder.Files
GetFileNameInSubFolders objFSO.GetFolder(sScriptDir)
If Is64BitOS() Then
For Each sElement In dicFileName.Keys
RegEx.Pattern = “X64”
If RegEx.Test(sElement) Then
strCommand = sElement & “\” & dicFileName.Item(sElement)
RC = WshShellExec( strCommand, OptionsExec )
End If
Next
Else
For Each sElement In dicFileName.Keys
RegEx.Pattern = “X86”
If RegEx.Test(sElement) Then
‘WScript.Echo sElement & “\” & dicFileName.Item(sElement)
RC = WshShellExec( strCommand, OptionsExec )
End If
Next
End If
Sub GetFileNameInSubFolders(Folder)
Dim objFile, Subfolder, colFiles
For Each Subfolder in Folder.SubFolders
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
If Not dicFileName.Exists(Subfolder.Path) Then
dicFileName.Add Subfolder.Path, objFile.Name
End If
Next
‘ Wscript.Echo
GetFileNameInSubFolders Subfolder
Next
End Sub
Function Is64BitOS()
Const Path = “winmgmts:root\cimv2:Win32_Processor=’cpu0′”
Is64BitOS = (GetObject(Path).AddressWidth = 64)
End Function
Function WshShellExec( strCommand, OptionsExec )
Dim objExec ,strCmd
strCmd = strCommand & ” ” & OptionsExec
‘WScript.Echo strCmd
Set objExec = objShell.Exec(strCmd )
Do While objExec.StdOut.AtEndOfStream True
strResults= objExec.StdOut.ReadAll
Loop
End Function
Maarten van Willigen
Informatie & Communicatie Technologie
Technical Specialist
Cofely Nederland NV
I had a problem with Server 2012 R2 and the 2015 VC++ installer. It was restarting the computer during the Task Sequence which would result in a Dirty Deployment warning. I was able to resolve this by editing the WSF script and adding a “/norestart” switch to the VC++ installers.
Unfortunately, the 2005 and 2008 installers don’t support this switch so I created a second variable (don’t forget to declare it first):
Dim sAdditionalArguments
sAdditionalArguments = “/norestart”
and changed each of the 2010 and later installer lines as follows (ex. of 2010×86):
iRetVal = oUtility.RunWithHeartbeat(“””” & sSetupFile2010x86 & “”” ” & sArguments & ” ” & sAdditionalArguments)
Thanks for the awesome work!
Has anyone noticed any issues with the C++ 2015 installer on Windows 7 machines lately? I updated our Win7 ref-image the other day and noticed that the installer process for x86 C++ 2015 never stops, so the script never continue. After the x86 installer had been running for 60 minutes I gave up and manually killed the process. Once I did that the script happily started with the x64 versions. I also noticed that this only happens on Windows 7 machines (I have only tried with 64-bit though since we do not use 32bit windows in our enviroment).
I’m using the same script/installer on our Windows 10 image and on that machine it works just fine. So I know it’s nothing wrong with the script. I’m just curious if anyone else has experienced any issues specifically with Windows 7 64bit?
Yes,, it is weird. The solution could be to add them first of all apps, also, make sure you restart the OS before install…
Strange indeed. I tried to add the installer first of all apps, and I even added a restart computer before the installation for good measure. But it still stuck on the 2015 installer.
To solve it I ended up splitting the script in to two separate script. One for the 2005-2013 runtimes and one for the 2015 runtime only, and adding a restart computer in between the two scripts. Not sure why this happens, I will investigate when I got more time on my hands. For now it’s working good enough :)
I just split the task and added the reboot before C++ 2015 as described above and the installation flew right by. Ending the C++ 2015 x86 process also worked, otherwise the C++ 2015 install took about 3 or 4 hours before timing out.
Ok, that should not be needed. We run it in a number of placec, no issues. I added one thing to it and that is a /noreboot switch. For us the 2015 takes approx. 3 minutes to install. I think I need to investigate this a bit.
So I just edited the script to install C++ 2015 x86 first and all of the runtimes installed. That was the only change I made to the script.
it could actually be that, the /noreboot switch that we added, the reason for timing out could be that it tries to reboot. Check if the version you have downloaed contains the noreboot for vc2015
I’ve tried the script both with and without /noreboot swtiches but unfortunately it makes no difference.
Just thought i would add that im seeing problems with this if you are deploying autodesk software to Your machines. As you can see from the links below you will actually have to make sure to uninstall the redistributable from the machine before running the installation of Autocad.
https://knowledge.autodesk.com/search-result/caas/sfdcarticles/sfdcarticles/2011-Troubleshooting-Error-1603-in-AutoCAD-Map-3D.html
https://knowledge.autodesk.com/support/autocad-lt/troubleshooting/caas/sfdcarticles/sfdcarticles/Error-when-trying-to-install-earlier-version-of-Microsoft-Visual-C-2010-Redistributable-package.html
2005 is suddenly requiring a reboot before it will continue – do you think adding a reboot before this app will make a difference?
No, but you need to update your unattended xml file! You need to block WU from running BEFORE it is suppose to run.
Change Microsoft-Windows-Shell-Setup | OOBE | ProtectYourPC = 1 to Microsoft-Windows-Shell-Setup | OOBE | ProtectYourPC = 3
https://technet.microsoft.com/en-us/library/cc749195(v=ws.10).aspx
Does this apply to windows 10 as well? Windows 10’s tendency to automatically start downloading and installing drivers during deployment has given me some headaches these past days. And if there is some way to block it without actually preventing internet access i would be happy.
Yes, it works on W10, it does not “block” access, but it prevents WU from getting any ideas….
That’s great! I may use it, not just for my ref-image capture task sequence, but for my OS deployment task sequence as well.
Thank you Mikael, as always :)
Is there any reason why you shouldn’t use wscript.exe as opposed to cscript.exe when defining the MDT Application quiet install command?
Yes, all the underplaying scripts needs to run using cscript