Repaving your PC: the easier way

Edit on GitHub

It"’s been a while since I had to repave my laptop. I have a Windows Home Server (WHS) at home which images my PC almost daily and allows restoring it to a given point in time in less than 30 minutes. Which is awesome! And which is how I usually “restore” my PC into a stable state.  Over the past year some hardware changes have been made of which the most noteworthy is the replacement of the existing hard drive with an SSD. A great addition, and it was easy to restore as well: swap the disks and restore the image from WHS. SSD and full system install? 30 minutes.

imageThe downside of restoring an image which came from a non-SSD drive has been bugging me for a while though. My SSD did not feel as fast as it should have felt, resulting in me reinstalling Windows on it just to check if that led to any speed improvements. And it did. And I knew I was in trouble: that would be a load of software to re-install and reconfigure. Here’s a list of what I had on my system before and is absolutely required for me to be able to do my job:

  • Telnet client
  • PDFCreator
  • ZoomIt
  • Win7 SP1
  • Virtual CloneDrive
  • HP Printer Corporate Edition
  • Ccleaner
  • Virus scanner
  • Adobe Flash
  • Adobe PDF
  • Silverlight
  • Office 2010
  • Windows Live Writer
  • Windows Live Mesh
  • WinRAR
  • Office Live Meeting & Communicator
  • VS 2010
  • VS 2010 SP1
  • GhostDoc
  • Resharper
  • Windows Azure Tools
  • WIF tools
  • MVC 3 tools
  • SQL Express R2
  • SQL Express Management Tools
  • Webmatrix
  • IIS Express
  • Firefox
  • Chrome
  • Notepad++
  • NuGet Package Explorer
  • Paint.net
  • Skype
  • TortoiseHg
  • TortoiseSVN
  • Fiddler2
  • Java (sorry :-))
  • Zune

Oh boy… Knowing how '”fast” some of these can be installed, that would cost me a day of clicking and waiting.

[edit]Also checkout https://github.com/chocolatey/chocolatey/issues/46[/edit]

Three tools can save you a lot of that work

Fortunately, we live in this time of computers. A time where some things can be automated and it seems like a PC repave should be relatively easy to do. There are three tools that will save you time:

  • Ninite, which you can find at www.ninite.com. Ninite allows you to download and install some items of the list above in one go. I’ve packaged Flash, Acrobat Reader, Chrome, Firefox, Java, … using Ninite and was able to install these items in one go. Great!
  • Web Platform Installer (Web PI) – command line version. A small executable which is able to pull a lot of software from Microsoft and install it in one go. Things like .NET 4, Silverlight, the ASP.NET MVC 3 tooling, … are all on the Web PI feed and can be downloaded in one go.
  • Chocolatey, available at www.chocolatey.org. Chocolatey is a tool based on NuGet which uses a feed of known software and can install these from the command line. For example, “cinst notepadplusplus” is enough to get NotePad++ running on your system.

Using these three tools, I have created a script which you have to run in a PowerShell administrative console. The scripts consist of calls to the Web PI, Ninite and Chocolatey. I’ll give you an example:

1 # Windows Installer 2 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:WindowsInstaller31" 3 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:WindowsInstaller45" 4 5 # Powershell 6 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:PowerShell" 7 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:PowerShell2" 8 9 # .NET 10 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:NETFramework20SP2" 11 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:NETFramework35" 12 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:NETFramework4" 13 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:JUNEAUNETFX4" 14 15 # Ninite stuff 16 cmd /C "ninite\ninite.exe" 17 18 # Chocolatey stuff 19 iex ((new-object net.webclient).DownloadString("http://bit.ly/psChocInstall")) 20 21 cinst windowstelnet 22 cinst virtualclonedrive 23 cinst sysinternals 24 cinst notepadplusplus 25 cinst adobereader 26 cinst msysgit 27 cinst fiddler 28 cinst filezilla 29 cinst skype 30 cinst paint.net 31 cinst ccleaner 32 cinst tortoisesvn 33 cinst tortoisehg 34 35 # IIS 36 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:IIS7" 37 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:ASPNET" 38 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:BasicAuthentication" 39 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:DefaultDocument" 40 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:DigestAuthentication" 41 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:DirectoryBrowse" 42 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:HTTPErrors" 43 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:HTTPLogging" 44 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:HTTPRedirection" 45 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:IIS7_ExtensionLessURLs" 46 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:IISManagementConsole" 47 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:IPSecurity" 48 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:ISAPIExtensions" 49 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:ISAPIFilters" 50 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:LoggingTools" 51 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:MetabaseAndIIS6Compatibility" 52 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:NETExtensibility" 53 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:RequestFiltering" 54 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:RequestMonitor" 55 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:StaticContent" 56 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:StaticContentCompression" 57 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:Tracing" 58 cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:WindowsAuthentication"

For those interested, here’s the set of scripts I have used: Repave.zip (986.66 kb). These contain a number of commands that use the tools mentioned above to do 75% of the install work on my PC. All I had to do was install Office 2010, VS2010 and my scripts did the rest. Not the holy grail yet, but certainly a big relief of a lot of frustration finding software and clicking next-next-finish. And now my PC has been repaved, it’s time for a WHS image again. Enjoy!

This is an imported post. It was imported from my old blog using an automated tool and may contain formatting errors and/or broken images.

Leave a Comment

avatar

6 responses

  1. Avatar for Rob
    Rob November 29th, 2011

    So I own [b]most[/b] of the webpi stuff, except where things are required prior to chocolatey installation.

    https://gist.github.com/140...

  2. Avatar for Brad
    Brad December 12th, 2011

    Do you turn UAC off or something? Those scripts dont work in any way, shape or form for me. It just tosses errors in windows that close immediately. The command line is such a primitive disaster.

  3. Avatar for Rob
    Rob December 13th, 2011

    You will never get past UAC. Chocolatey will stop and ask for permission if it needs to, I am unsure of the other tools. You can temporarily disable it for this process so you can get everything installed in one fell swoop.

  4. Avatar for Geert Serneels
    Geert Serneels December 23rd, 2011

    At this moment version 4 of WebPI is available.
    If you download v4, you will need to do some changes.

    1. &#39[u]WebPiCmdline[/u]&#39 has been renamed to &#39[u]WebPiCmd[/u]&#39
    2. It requires a new parameter &#39/Install&#39 (btw, it seems that this should be the first one)
    For example : "PS C:\> [i]webpicmd /Install /Products:VS2010SP1Pack /AcceptEula /SuppressReboot[/i]"

    Btw, there&#39s also a Chocolatey package for WebPiCmd, wich contains v4.

  5. Avatar for Tim Schaeps
    Tim Schaeps February 18th, 2012

    Just run powershell as admin, it should work...

  6. Avatar for Matt Wrock
    Matt Wrock November 15th, 2013

    I know this post is a couple years old but I just stumbled upon it now. For those wanting a 100% unattended install that handles reboots/autologons, checkout a project I've been working on at http://boxstarter.org. I created it specifically for this scenario. It leverages chocolatey and intercepts it at various points to monitor for pending reboots and conflicting MSIEXEC processes. It ensures the entire install only requires one acceptance of elevated privileges in the beginning and then never bugs you again. It can even be used to setup remote machines.