Thursday, November 11, 2010

Quickly update all Telerik product installs using PowerShell

powershell-telerik With the Q3 2010 release now available, the challenge of updating your dev environment with the new versions can sometimes seem daunting. After all, the Telerik Ultimate Collection now represents more than 10 products, and thus more than 10 installers. Add any virtual machines you maintain to the mix, and the challenge of updating increases. Fortunately, all Telerik products use MSI installers, and with a little PowerShell we can easily script the complete system update.

Updating Your Telerik Products in 2 Steps

With a handy PowerShell script I've created (available below), you can easily update any system to use all of the latest and greatest Telerik tools in 2 simple steps:

  1. Download all of the Telerik products you want to install
    • Place the MSI installers in one folder
  2. Download and run my Telerik Installer PowerShell script!

That's it. The script will automatically look for and uninstall old versions (pre-Q3) of Telerik tools and then install all of the products you've downloaded. By default, the script will look for the installers in "C:\Program Files (x86)\Telerik\Downloads\Q3 2010\", but if you'd prefer to use a different location, the script can be easily edited.

Run and done

The cool benefit of this script is that you can download your bits, run the script, and then go about your business while the uninstallers and installers run. No need to "babysit" your machine installing and uninstalling software.

On my primary machine (which has an SSD), the entire process took about 10 minutes: 4 minutes to uninstall everything and about 6 minutes to run all of the installers. On a VirtualBox VM running on an external USB drive, the process took about 35 minutes (15 to uninstall, 20 to install).

Regardless of the exact run time, it took exactly 30 seconds of my time to update my entire Telerik toolbox.

Enabling PowerShell Script Execution

If you've never run a PowerShell script, you may have a problem executing this script due to PowerShell's default security settings. To resolve the problem, you simply need to run a PowerShell command that allows script execution. Here's how:

  1. Open a PowerShell command prompt
    • Can be done via Start > All Programs > Accessories > Windows PowerShell
    • Alternatively, right-click my PS1 script and select "Edit with PowerShell"
  2. Execute the following command: Set-ExecutionPolicy Unrestricted
  3. A dialog will pop-up. Confirm your decision to change the execution policy.

Now you will be able to execute this script by simply right-clicking on the .PS1 file selecting "Run with PowerShell."

What about the Telerik Visual Studio Extensions auto-updater?

The Telerik Visual Studio Extensions (VSX) are awesome for updating your existing projects, or for updating individual projects directly from Visual Studio. The Telerik VSX tools can automatically check for newer versions of the Telerik tools, download the bits, and then update your projects. If you only work with 1 or 2 products, this is a great solution!

If you're like me, though, and you have everything Telerik installed (and, really, you should), it's generally easier to update everything at once with the installers for a major Q release. That's where this script comes in handy. Once everything is installed, you can still use the VSX tools to quickly update your projects to use the latest bits.

Side-by-side Installs

You can install many Telerik products side-by-side with older versions. This is sometimes useful when you have projects referencing different versions of the Telerik tools (though there are other options for "isolating" projects). While this script is configured to uninstall everything old, if you'd prefer to keep old versions, a simple script edit can help you skip the uninstalls. If this scenario becomes common, I'll provide a modified version with easy support of this option.

Download the Script

All that's left: Download the PowerShell script. Remember to edit the script if your installers are saved in a different folder. Otherwise, enjoy the simple system updater and feel free to send me feedback and ideas for improvement!

2 comments:

Bryan Brannon said...

Awesome script. This takes the quarterly uninstall and re-install party off the todo list. Both machines updated in less than 20 minutes. Thanks Todd!

Chris said...

I would like to thank you for this very handy and useful script. May you can provide a version too which doesnt uninstall the previous versions of Telerik releases please?