Install vcredist and .NET unattended with puppet

If your applications need a msvcr100.dll or similiar file, you'll need to get one of the Microsoft Visual C++ 2010 Redistributable Package (x86) or another version installed.

This is a very simple task, if you are a human and have to do this only one time. If you have lots of PCs or servers and want to install this automated, you might want to do this with puppet.

The process is the same for any vcredist file, so I'll explain it for vcredist_2008_x64.exe.

Download the vcredist_2008_x64.exe from microsoft.com and put it into your files folder.

Then add:

exec { "vcredist_2008_x64.exe":
     cwd => "C:\\vagrant\\files",
     command => "C:\\vagrant\\files\\vcredist_2008_x64.exe /passive /norestart",
     creates => "C:\\Windows\\winsxs\\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_750b37ff97f4f68b",
     require => [  ]

to your default.pp. The cwd might be different, if you installed puppet by hand and are not in a vagrant environment.

You might wonder, how I got the path amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_750b37ff97f4f68b for the creates parameter.

Take a clean system and install your package (the vcredist_2008_x64.exe in our case). Then search if the file (e.g. msvcr100.dll) is available somewhere (in case of windows 2008 its in the folder C:\\Windows\\winsxs\\). As soon as it's installed, you know the correct path for the creates definition.

We have to add the creates parameter for the exec command, to avoid installation if the vcredist 2008 is already installed.

If you install the x64 version of vcredist 2008, some of your programs might not work. This happens, because they are 32bit programs.

Thus you also need:

exec { "vcredist_2008_x86.exe":
     cwd => "C:\\vagrant\\files",
     command => "C:\\vagrant\\files\\vcredist_2008_x86.exe /passive /norestart",
     creates => "C:\\Windows\\winsxs\\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91",
     require => [  ]

That's it!

As a bonus: How to install vcredist 2010 x64:

exec { "vcredist_2010_x64.exe":
     cwd => "C:\\vagrant\\files",
     command => "C:\\vagrant\\files\\vcredist_2010_x64.exe /passive /norestart",
     creates => "C:\\Windows\\system32\\msvcr100.dll",
     require => [  ]

and, how to install .NET 4.0:

exec { "dotNetFx40_Full_x86_x64.exe":
     cwd => "C:\\vagrant\\files",
     command => "C:\\vagrant\\files\\dotNetFx40_Full_x86_x64.exe /passive /norestart",
     creates => "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe",
     require => [ Package['7-Zip 9.20 (x64 edition)'] ]
In open source, puppet, vagrant, windows by
@ 05 Feb 2014, Comments at Reddit & Hackernews

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files