This is part two of a four part series on attempting to automate installation and setup of a development PC with a few scripts and some funky tools. If you haven’t already, why not read the introductory post about ninite? Disclaimer: this series was inspired by a blog from Maarten Balliauw.
Installing Frameworks and Components: WebPI
Microsoft’s Web Platform Installer makes finding and installing MS applications and components quite easy by bringing the way to find and install them into one central portal (when it works properly, that is.. grumblegrumble..):
It also comes in a command line flavour so you can script your component installation, and that’s what I’ll be using.
The list of available packages can be found with the “/list:available” parameter and it’s pretty long.
You can specify custom XML feeds to define your own products and applications to be installed; something that might be interesting to spin up a new instance of your company website on a new server, if you set your web server to run webpi from commandline using a custom feed pointing to the latest stable build of your web application (that’ll be an interesting follow up post at some point I think)!
A summary of the parameters available to you can be found here.
Fire up a command line and run “WebpiCmdLine.exe /List:available” to get a list of available products and applications. It didn’t look exhaustive to me, so I checked the xml locations listed at the beginning of this command:
For the current version of the WebPI (at time of writing this is v3.0) these are:
https://www.microsoft.com/web/webpi/3.0/webproductlist.xml
https://www.microsoft.com/web/webpi/3.0/webapplicationlist.xml
https://www.microsoft.com/web/webpi/3.0/mediaproductlist.xml
https://www.microsoft.com/web/webpi/3.0/toolsproductlist.xml
https://www.microsoft.com/web/webpi/3.0/enterpriseproductlist.xml
Trawling through these xml files you can see that apparently you can install VS2010SP1…
…but not SQL Tools (other than Express). I’ll get onto this lot shortly.
So for the meantime I’m now adding some more to my script to set up the .Net frameworks, Powershell, and Windows Installers:
REM Ninite stuff
cmd /C "Z:\Installation\SetupDevPC\Ninite_DevPC_Utils.exe"
REM WebPI stuff
cmd /C "Z:\Installation\SetupDevPC\webpicmdline.exe /AcceptEula /SuppressReboot /Products:PowerShell,PowerShell2,NETFramework20SP2,NETFramework35,NETFramework4"
cmd /C "Z:\Installation\SetupDevPC\webpicmdline.exe /AcceptEula /SuppressReboot /Products:WindowsInstaller31,WindowsInstaller45"
Notice the multiple products are comma delimited but without spaces; it bombs if you put a space after the comma.
You can split each product install out into its own webpicmdline.exe call, but this ends up reloading the five xml feeds for each product, which can take an age.
However, I’ve had to split it onto a couple of lines as the install of Windows Installer 4 fails if it’s on the same line as .Net 4. It also requires you to reboot, so since you’ve suppressed this you’ll see some log messages looking like “install: SUCCESS” then “verification: FAILURE”:
[code]Started downloading: WindowsInstaller45
DownloadedWindowsInstaller45
Started installing Products…
Started installing: WindowsInstaller45
Install completed (SuccessRebootRequired): Windows Installer 4.5
Reboot is required for product WindowsInstaller45. Install SUCCESS[/code]
YEY!!
[code]Verifying successful installation…
Windows Installer 4.5 False
Install of Products: FAILURE
Verifying successful log generation…
Windows Installer 4.5 Logs : False
Creation of Product Logs: FAILURE[/code]
uh.. BOOO! So you do actually need to reboot to get this to complete. As such, I’ve added in the final line for this file:
@echo off
REM Ninite stuff
cmd /C "Z:\Installation\SetupDevPC\Ninite_DevPC_Utils.exe"
REM WebPI stuff
cmd /C "Z:\Installation\SetupDevPC\webpicmdline.exe /AcceptEula /SuppressReboot /Products:PowerShell,PowerShell2,NETFramework20SP2,NETFramework35,NETFramework4"
cmd /C "Z:\Installation\SetupDevPC\webpicmdline.exe /AcceptEula /SuppressReboot /Products:WindowsInstaller31,WindowsInstaller45"
shutdown /r /t 0 /d P:0:0
The install directory has grown a little bit too:
It’s getting a bit trickier now. There are issues with this, and I’ll sum it all up in part 4. However, next up is some sweet goodness:
Scripting the setup of a developer PC, Part 3 of 4 – Installing.. uh.. everything.. with Chocolatey.
Update: there is now a v4 of WebPI command line that requires “/install” as the first parameter and is called WebPICmd instead of webpicmdline. Since I’d downloaded v3, that’s the version I’m scripting for. Check out v4 though, as it has added support for “offline mode”; you can download the installers and dependencies for any number of products (to a network share perhaps) and install from there instead of the interwebs – I will do a follow up article doing exactly that 😉