Twitter Feed Popout byInfofru

OverrideThis.com

Adventures in .NET Software Craftsmanship!

WebPiCmdLine–Easily provision your Web Servers!

The Web Platform Installer is Microsoft’s solution for distributing framework, products and applications that revolve around their web platform solutions.  If you are a web developer like me, it is probably the first thing you need to install on your development box or on the servers you manage.  Needless to say, I am a big fan but I don’t think I realized its true potential until I stumbled into the command line version of the Web Platform Installer, also known as the WebPiCmdLine.  Now, I get to do a lot of the infrastructure work in the projects that I take part of that means provisioning servers, installing the Continuous Integration software (Build Server), automating deployments to staging and production environments. In other words, I implement and design Deployment Pipelines for Continuous Delivery processes.  Anyway, too much conversation, lets look at a couple of working examples of when the WebPiCmdLine is useful and convenient.

 

Example 1 – Ramping up a Basic Developer Box

Lets say you want to install basic development tools on a Windows 7 Professional fresh install, perhaps you are performing a demo of a basic web application or maybe you are installing the latest and greatest technology and don’t want to ruin your current development environment.  Well one way you could setup all the required software on a fresh install  is to download the Web Platform Installer and browse through their list of frameworks, products and applications and click which products you want to install and your done.  The drawback though, is that you would have to be clicking around to find all the products and accepting all the EULA (End User License Agreement), it just takes too much attention and time.  The quick and easy way is to use the WebPiCmdLine to do the work.  Now my assumptions for the following snippet of code is that you have downloaded the WebPiCmdLine and extracted its content to a local folder on your drive, in my case “C:\Installer\WebPiCmd\”, the following script is located in the “C:\Installer\” folder.

 

@rem installer.cmd
SET WebPiCmd=.\webpicmd\WebPiCmd.exe
%WebPiCmd% /Install /Products:NETFramework4 /AcceptEula
%WebPiCmd% /Install /Products:SQLExpress /SQLPassword:P@ssw0rd /AcceptEula
%WebPiCmd% /Install /Products:SQLManagementStudio /AcceptEula
%WebPiCmd% /Install /Products:VWD /AcceptEula
%WebPiCmd% /Install /Products:MVC3 /AcceptEula
%WebPiCmd% /Install /Products:MVC4VS2010 /AcceptEula

 

Example 2 – Web Server for ASP.NET MVC Applications

The setup would be the same as above but in this scenario we are installing on top a Windows Server 2008 R2 fresh install.  This would be our web server to showcase a basic ASP.NET MVC application.

 

@rem installer.cmd
SET WebPiCmd=.\webpicmd\WebPiCmd.exe
%WebPiCmd% /Install /Products:NETFramework4 /AcceptEula
%WebPiCmd% /Install /Products:IIS7 /AcceptEula
%WebPiCmd% /Install /Products:MVC3 /AcceptEula
%WebPiCmd% /Install /Products:MVC4VS2010 /AcceptEula

 

Conclusion

I wrote a blog, not so long ago, about installing Rails on Ubuntu and how I had scripted out a basic install to ease the process of rolling a new Ubuntu image and rebuilding my developer environment.  The script that I wrote was fairly complex and tedious, but if a Linux noob like me could write it anybody can.  At the time, I felt there was no equivalent easy way to perform quick and clean scripted installations on the Windows platform but recent research has shown me that times are changing.  The WebPiCmdLine is just one of the relatively new tools (see NuGet, Chocolatey, or PowerShell)  that are providing developers the power to write deployment and automation scripts for the windows platform.  One comment, I do feel that the Web Platform Installer is powerful and useful enough that it really shouldn’t be only associated with the web, why not re-brand it as the Windows Platform Installer, and let it be used for installing anything on the operating system.