WebPi Command Line
Our much loved Web Platform Installer (WebPI) now has a command line interface. Yes that’s right. Now it is possible to do everything that you could do in WebPi UI, from the commandline.
Think scripting! Think automation!
WebPi is a simple but powerful tool for discovering, installing and configuring Microsoft’s Web Platform Products. It has been 2 years of great journey for the WebPi team shipping 3 versions. It has been a great partnership with the community. We have been aware of the feedback we received from the community for a way to be able to automate Webpi Tasks. So, here we are releasing WebpiCmdline, which is the short for ‘Web Platform Installer Command line’.
Download links
WebpiCmdline_x86.zip file is hosted here http://go.microsoft.com/fwlink/?LinkId=209681
WebpiCmdline Usage:
File | Sha1 |
Microsoft.Web.Deployment.dll | 8AB6DC57BB6F3D557E785FAEB61CDE669FF96641 |
Microsoft.Web.PlatformInstaller.dll | 8B6136C497B6AAFC8C562660F2EAF85CE34E1FCE |
Microsoft.Web.PlatformInstaller.UI.dll | 909632EF16F8659CD5DFF47A64694B96F546B82D |
WebpiCmdline.exe | E171EB35EF752CB06C2F64483C8E019D90C635F5 |
license.rtf | 8503CFE14935BAAED0D607BCB60624FCD9CFBD4B |
Recommended: Copy just WebpiCmdline.exe to the directory where you have installed Web Platform Installer (Typically %program files%\Microsoft\Web Platform Installer\) and run it from here. Do not copy the rest of the dll’s. This will ensure you are always running WebpiCmdline with the latest WebPi dll’s.
Usage Overview
It is recommended to run WebpiCmdline from a Command Prompt which is opened as Administrator. (Otherwise, WebpiCmdline will elevate itself and launch a new window which will close as soon as it is done.) To open a command prompt as “Administrator” on Windows Vista or Windows 7, type “cmd” in the start menu, Press Shift and then Right click the cmd.exe, select “Run as Administrator”. Accept UAC if necessary. Change directory at the cmd prompt to the folder where you have installed WebpiCmdline.
WebpiCmdline usage can be broadly categorized into two modes
Install Mode:
/Products:<ProductIds> Install a Product using WebpiCmdline
Ex: >WebpiCmdline.exe /Products: MVC3, Silverlight4Toolkit
Will install MVC 3 and Silverlight4Toolkit Products
/Applications: <Appid> Install a Web Application using WebpiCmdline
Ex: > WebpiCmdline.exe /Applications:Wordpress
Will install Wordpress Web App Application
List Mode:
/List:<All | Available | Installed > List the products hosted on the Web Platform Feeds
/List:Feeds List the Web Platform Feeds being used
/List:Languages List the list of available languages for WebpiCmdline
Ex: >WebpiCmdline.exe /List:Available
Will list all the available products and applications for the current platform on which it was run.
Ex: > WebpiCmdline.exe /List:Feeds
Will list all the master feeds being consumed by WebpiCmdline
Arguments
Let us look at the list of arguments which WebpiCmdline exposes.
Here is an msdn page explaining the most common command line arguments of WebpiCmdline
http://msdn.microsoft.com/en-us/library/gg433092.aspx
The arguments which are not covered in this article are described below
Option |
Description |
/SuppressReboot |
Specifies that WebpiCmdline should not Auto-Reboot the machine in the case of one of the installation requests reboot. If not specified, WebpiCmdline will reboot the machine if one of the products installed requests for reboot. The installation will continue once the machine comes back after reboot. |
/AcceptEula |
Specifies that WebpiCmdline should Auto-Accept Eula’s. If not specified, WebpiCmdline will prompt the user to accept the Eula’s before installation can begin. |
Common Usage Scenarios
Let’s cover the most common User Scenarios for WebpiCmdline, and how to run them.
Installing a product hosted on Web Platform Feeds.
For these walkthroughs, let’s assume that the user is trying to install Web deploy
Find whether the Product you want to install is actually hosted on WebPi Feeds
WebpiCmdline.exe /List:All
Verify that the product MVC 3 is actually listed in the output of this command and is listed under “Available”. (if the product is listed under ‘Previously Installed Products’, you already have the product installed)
--Available Products
ID Title
----------------------------------------
WDeploy Web Deployment Tool 2.0
Install the product using the ID listed above
WebpiCmdline.exe /Products:WDeploy
Accept Eula when prompted
You are responsible for and must locate and read the license terms for each of the software above. Do you agree to the license terms for each of the third-party and/or Microsoft software listed above (Y/N)?
Done.
Automating the above Installation
Above installation is not scriptable, as it expects users to accept the EULA before installation.
In order to automate the above installation, append /AcceptEula to the above install command
WebpiCmdline.exe /Products:WDeploy /AcceptEula
Installing multiple products
In order to install multiple products, pass the product IDs as a comma separated list to the /Products: argument.
WebpiCmdline.exe /Products:WDeploy,MVC3,VWD,SQLExpress /AcceptEula
Avoid Automatic Reboot
By default, WebpiCmdline will reboot the machine if any of the products it has installed requests a reboot. When the machine comes back, WebpiCmdline will continue installing.
Sometimes this might not be the most desirable way. In order to suppress reboot, pass the /suppressreboot argument. This will make WebpiCmdline quit as soon as it is requested for a reboot by any product. Once the user reboots the machine later, WebpiCmdline will come back to life and complete installation.
WebpiCmdline.exe /Products:WDeploy,MVC3,VWD,SQLExpress /AcceptEula /SuppressReboot
Provide your own Log Name
By default, WebpiCmdline logs to a text file in the working directory, named as “Current date time”.txt. Example : 1.25.2011 1.44.08 PM.txt
If you wish to rename this file, pass the /log: argument
WebpiCmdline.exe /Products:WDeploy /AcceptEula /Log:wdeployinstalllog.txt
Provide database Admin Passwords during installation
When WebpiCmdline installs SQL or MySQL database, it prompts the users to enter the root/admin/sa password to be used for the database. To Automate this use case , use the /Sqlpassword & /Mysqlpassword arguments
WebpiCmdline.exe /Products:SQLExpress /AcceptEula /SQLPassword:MySecretPassword
Install a product from a different language
Some products, for example VWD, are available in multiple languages. By default, if no language is provided, WebpiCmdline will always install the English version of the Product. To specify your desired language, use the /Language Argument
WebpiCmdline.exe /Products:VWD /AcceptEula /Language:FR
To get the list of languages, use the /list:Language argument explained above.
Install a product from a different Master feed
By default, WebpiCmdline fetches master feeds from the Microsoft.com/Gallery website. To view this info, use the /List:Feeds option explained above.
To force WebpiCmdline to fetch master feeds from a different location, use the /XML Argument
WebpiCmdline.exe /Products:MyProduct /XML:http://mywebsite.com/myfeed.xml
Install a product from a different Custom feed
By default, WebpiCmdline does not load any custom feeds. It only works with the Master feeds. By providing a custom feed, you can add another feed to the existing list of Master feeds. Refer this blog post for more info on this : http://blogs.iis.net/kateroh/archive/2010/02/11/webpi-apis-install-a-product-from-a-custom-feed.aspx
WebpiCmdline.exe /Products:MyProduct /feeds:http://mywebsite.com/mycustomfeed.xml
Install a Web Application
WebpiCmdline can install Web Applications too. Web Applications are always installed to a Webserver. The Web Server can be either IIS or IISExpress. By default, WebpiCmdline always installs Web Applications to IIS.
WebpiCmdline.exe /Applications:Wordpress
To install to IISExpress, use the /IISExpress Argument
WebpiCmdline.exe /Applications:Wordpress /IISExpress
After accepting EULA, WebpiCmdline will prompt the user to enter the Application Parameters which will be used to configure the Application Installation. This is the manual mode of installing Web Applications.
Please Enter Web Application Parameters for \"WordPress\"
Application Path(Press Enter to use:Default Web Site/wordpress):<press Enter>
Database Server(Press Enter to use:localhost): <press Enter>
Database Name(Press Enter to use:wordpress): <press Enter>
Database User Name(Press Enter to use:wordpressuser): <press Enter>
Database Password: mysecretpassword
Database Administrator(Press Enter to use:root): <press Enter>
Database Administrator Password: mysecretrootpassword
Unique Key for Passwords(Press Enter to use:put your unique phrase here): <press Enter>
Unique Key for Secure Passwords(Press Enter to use:put your unique phrase here): <press Enter>
Unique Key for Authentication(Press Enter to use:put your unique phrase here): <press Enter>
Second Unique Key for Authentication(Press Enter to use:put your unique phrase here): <press Enter>
Parameters written to WordPress0.app
To use the default value for the parameter, just press enter. Or enter the value manually.
Some parameters don’t have default value, and the user is expected to enter the value manually.
Finish installation.
Automating Web Application Installs
As you might have noticed above, Web Application installs are not very silent. They prompt for user inputs to configure the web application.
To automate web application installs, the user is expected to provide a ‘.app’ file along with the appid.
The .app file is generated when you run an app install in Manual Mode (See the last line of the above example :
Parameters written to WordPress0.app
This ‘.app’ file is the application parameter-value file which is used to configure the application parameters. Contents of WordpressParams.app file :
AppPath[@]Default Web Site/wordpress
DbServer[@]localhost
DbName[@]wordpress
DbUsername[@]wordpressuser
DbPassword[@]mysecretpassword
DbAdminUsername[@]root
DbAdminPassword[@]mysecretrootpassword
Key1[@]put your unique phrase here
Key2[@]put your unique phrase here
Key3[@]put your unique phrase here
Key4[@]put your unique phrase here
To re-use this file, run
WebpiCmdline.exe /Applications:Wordpress@Wordpress0.app
This will run Wordpress installation in silent mode, i.e., the user is not prompted for Parameter values.
You can tweak the app file values by opening the .app file in notepad and editing it before re-using.
Known Limitations
When installing a Web Application which supports 2 databases, WebpiCmdline always defaults to the first database listed in the application manifest. WebPi UI however, does provide support where the user can chose between the databases.
WebpiCmdline and Windows Azure
Webpicmdline is also built as ‘Any Cpu’ binary for startup steps of Windows Azure. You can download webpicmdline_anycpu.zip from :
http://go.microsoft.com/?linkid=9752821
Why 2 builds? Webpicmdline works with iisexpress to install Web Applications to IISExpress. However IISExpress is a 32 bit process, and so WebpiCmdLine is built as 32 bit (x86) binary.
However, there are scenarios where Webpicmdline is run as a system startup task, like Windows Azure startup tasks. Webpicmdline_x86 runs into errors when it is run as 32 bit process under system account on a 64 bit machine. Therefore you would need to use the _anycpu binary.
It is important to figure out which suits your purpose before downloading. As a rule of thumb
- if you are not running webpicmdline under system account, you should download Webpicmdline_x86.zip from http://go.microsoft.com/fwlink/?LinkId=209681 (even if you are on a 64 bit machine).
- if you will be running webpicmdline under system account, you should download Webpicmdline_anycpu.zip from http://go.microsoft.com/?linkid=9752821. The only limitation would be that Webpicmdline will not be able to install Web Applications to IISExpress.
Acknowledgement
Big thanks to Anpalm, Kateroh, andrewbi, crystalh, csfanos for their effort and nitashav who drove the original vision.