{"id":23,"date":"2015-01-13T12:50:37","date_gmt":"2015-01-13T20:50:37","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/cesardelatorre\/2015\/01\/13\/automating-windows-environments-setup-with-boxstarter-and-chocolatey-packages\/"},"modified":"2015-01-13T12:50:37","modified_gmt":"2015-01-13T20:50:37","slug":"automating-windows-environments-setup-with-boxstarter-and-chocolatey-packages","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/automating-windows-environments-setup-with-boxstarter-and-chocolatey-packages\/","title":{"rendered":"Automating Windows environments\u2019 setup with Boxstarter and Chocolatey packages"},"content":{"rendered":"<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1373.image_3921F40D.png\"><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0068.image_thumb_01DDFD83.png\" width=\"538\" height=\"132\" \/><\/a><\/p>\n<p>Talking last week with <strong>Scott Hanselman<\/strong> he showed me in his laptop some cool stuff which is very useful for me as I usually need to re-install my machines pretty often due to the release of new betas and the fact that I prefer to start with clean machines whenever I can. And you know, every time you have a new machine or .VHD, you need to re-install a lot of different tools and apps. It is not just about Visual Studio and Office, and sometimes you forget the list of all the apps you need. <\/p>\n<p>So, in a different page, I usually use .VHDX to boot Windows natively (Check this blog post \u201c<a href=\"http:\/\/blogs.msdn.com\/b\/cesardelatorre\/archive\/2014\/10\/18\/booting-windows-8-1-update-natively-from-a-vhdx-image.aspx\">Booting Windows 8.1 Update natively from a .VHDX image<\/a>\u201d that I wrote) and it is very convenient as I have like rollback Windows images so I can come back to a baseline, but in any case, after going back to a previous baseline the .VHDX image will usually still have to have quite a few programs to be re-installed manually, like Adobe PDF Reader, Chrome, fiddler, Live Blog Writer, etc. Even more, I might need to install different physical machines so they have different .VHDs to set up\u2026<\/p>\n<p>This is when this stuff that Scott was telling me comes to action, so you can install a list of your most common programs\/apps for your Windows machine in an automated way thanks to <strong>Boxstarter<\/strong> and <strong>Chocolatey<\/strong> packages. Chocolatey packages are nothing but a PowerShell script wrapped as a Nuget package per application that I want to install.<\/p>\n<p>Basically, with Boxstarter you have repeatable, reboot resilient Windows environment installations made easy using Chocolatey packages.<\/p>\n<p><strong>Bottom line, I just have to run BoxStarter by providing my applications&#8217; list and all the software I require will be installed in an automated way!<\/strong><\/p>\n<p>Here are the steps I followed.<\/p>\n<h2>Step 1 \u2013 Compose my installation script<\/h2>\n<p>You could directly provide the package\/application to be installed directly in the URL, like in the following line in the console command prompt:<\/p>\n<p><strong>START <\/strong><a href=\"http:\/\/boxstarter.org\/package\/skype\"><strong><\/strong><a href=\"http:\/\/boxstarter.org\/package\/skype,fiddler4\">http:\/\/boxstarter.org\/package\/skype<\/a><\/a>,fiddler4<\/a>&#160; (or directly putting the URL in IE with no \u201cSTART\u201d, Note that this will not work on Chrome or Firefox unless you have a &quot;Click-Once&quot; extension)<\/p>\n<p>But as soon as you have quite a few applications to be installed and with custom setup, you might want to have an installation script, so the following procedure is a better way.&#160; <\/p>\n<p>This is simply a text file (.txt) where you can specify Windows configuration plus all the applications you want to install. The following is part of my own installation script:<\/p>\n<p><strong>BoxStarter_Script.txt<\/strong><\/p>\n<p><font face=\"Consolas\">Set-ExplorerOptions -showProtectedOSFiles -showFileExtensions <\/font><\/p>\n<p><font face=\"Consolas\">Enable-RemoteDesktop <\/font><\/p>\n<p><font face=\"Consolas\">cinst adobereader <\/font><\/p>\n<p><font face=\"Consolas\">cinst google-chrome-x64 <\/font><\/p>\n<p><font face=\"Consolas\">cinst imageresizerapp <\/font><\/p>\n<p><font face=\"Consolas\">cinst skype<\/font><\/p>\n<p><font face=\"Consolas\">cinst f.lux&#160; <\/font><\/p>\n<p><font face=\"Consolas\">cinst WindowsLiveWriter <\/font><\/p>\n<p><font face=\"Consolas\">cinst sysinternals <\/font><\/p>\n<p><font face=\"Consolas\">cinst git <\/font><\/p>\n<p><font face=\"Consolas\">cinst git.install <\/font><\/p>\n<p><font face=\"Consolas\">cinst Microsoft-Hyper-V-All -source windowsFeatures <\/font><\/p>\n<p><font face=\"Consolas\">cinst IIS-WebServerRole -source windowsfeatures<\/font> <\/p>\n<p>But rather than just storing that .TXT file somewhere in a drive or USB pen drive, so it is a risk as I could lose it, what I\u2019m doing is to store that .TXT file online as a Gist in GitHub, so it is always available to me when using BoxStarter (since I need Internet Access in any case). You can create your own Gist in your GitHub account, it is super simple, as shown below.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8322.image_50DE4CD5.png\"><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7506.image_thumb_487F98E0.png\" width=\"844\" height=\"620\" \/><\/a><\/p>\n<p>You can get the URL (permalink) to your script by pressing the \u201cRaw\u201d button, so you\u2019ll get something like:<\/p>\n<p><a title=\"https:\/\/gist.githubusercontent.com\/CESARDELATORRE\/2c3b3ee2d3495e46b3fb\/raw\/a555f5c6664bc6b99b77ab6d30905cd96e31bc31\/BoxStarter_CESARDL_Script.txt\" href=\"https:\/\/gist.githubusercontent.com\/CESARDELATORRE\/2c330905cd96eXXXXX\/BoxStarter_CESARDL_Script.txt\">https:\/\/gist.githubusercontent.com\/CESARDELATORRE\/2c330905cd96eXXXXX\/BoxStarter_CESARDL_Script.txt<\/a><\/p>\n<p>That is the URL of your script you need to provide to BoxStarter in order to install your applications.<\/p>\n<p><strong>IMPORTANT<\/strong>: Take into account that whenever you change the content of your GIST .txt file, the URL (permalink) will change, since you have a different URL per versi\u00f3n. So, if you change the list, you NEED to get the new URL.<\/p>\n<h2>Step 2 \u2013 Run the Script<\/h2>\n<p>So! here is how you run BoxStarter and you get all your software installed!<\/p>\n<p>Execute the following command (specifying your own script .TXT file), in a Windows Console:<\/p>\n<p>START <a href=\"http:\/\/boxstarter.org\/package\/nr\/url?https:\/\/gist.githubusercontent.com\/CESARDELATORRE\/2c3b3e_YOUR_URL_a71e\/BoxStarter_Script.txt\">http:\/\/boxstarter.org\/package\/nr\/url?https:\/\/gist.githubusercontent.com\/CESARDELATORRE\/2c3b3e_YOUR_URL_a71e\/BoxStarter_Script.txt<\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2318.image_4AE35DA2.png\"><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2570.image_thumb_5CBFF16F.png\" width=\"777\" height=\"236\" \/><\/a><\/p>\n<p>It will download BoxStarter thru INTERNET EXPLORER and Click-Once deployment and start executing the setup Process:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8053.image_435A7EE6.png\"><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7824.image_thumb_630958AE.png\" width=\"775\" height=\"155\" \/><\/a><\/p>\n<p>You can see below how it is installing Google Chrome, for instance:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3581.image_2DFF5A2F.png\"><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3010.image_thumb_4625553B.png\" width=\"777\" height=\"722\" \/><\/a><\/p>\n<h2>What applications are available as Chocolatey packages?<\/h2>\n<p>Like I said, you install the applications thru Chocolatey packages which are nothing but a PowerShell script wrapped as a Nuget package per application that I want to install. Sure, you can create your own packages, but usually you\u2019d like to go on the fast lane and use the already published packages. There are many available already. You can check the list out right here:<\/p>\n<p><a title=\"https:\/\/chocolatey.org\/packages\" href=\"https:\/\/chocolatey.org\/packages\">https:\/\/chocolatey.org\/packages<\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5468.image_2E741127.png\"><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4137.image_thumb_0B01AF86.png\" width=\"771\" height=\"902\" \/><\/a><\/p>\n<p>For instance, this is the <strong>Office 365 Pro Plus package<\/strong>:<\/p>\n<p><a href=\"https:\/\/chocolatey.org\/packages\/Office365ProPlus\">https:\/\/chocolatey.org\/packages\/Office365ProPlus<\/a><\/p>\n<p>You can add it to your list by writing:<\/p>\n<p><font face=\"Consolas\">cinst office365proplus <\/font><\/p>\n<p><font face=\"Consolas\">Or for <strong>Visual Studio 2013 Ultimate RTM<\/strong>:<\/font><\/p>\n<p><a title=\"https:\/\/chocolatey.org\/packages\/VisualStudio2013Ultimate\" href=\"https:\/\/chocolatey.org\/packages\/VisualStudio2013Ultimate\">https:\/\/chocolatey.org\/packages\/VisualStudio2013Ultimate<\/a>&#160;<\/p>\n<p>(Check this URL to install optional features in VS 2013)<\/p>\n<p><font face=\"Consolas\">cinst visualstudio2013ultimate <\/font><\/p>\n<p><font face=\"Consolas\">or with optional features:<\/font><\/p>\n<p><font face=\"Consolas\">cinst VisualStudio2013Ultimate -InstallArguments &quot;Blend LightSwitch OfficeDeveloperTools SQL WebTools Win8SDK WindowsPhone80&quot;<\/font><\/p>\n<p><font face=\"Consolas\"><\/font><\/p>\n<h2>Resources<\/h2>\n<p>For deeper info, check the following resources:<\/p>\n<p><a title=\"http:\/\/www.boxstarter.org\/\" href=\"http:\/\/www.boxstarter.org\/\">http:\/\/www.boxstarter.org\/<\/a><\/p>\n<p><a title=\"http:\/\/boxstarter.org\/WhyBoxstarter\" href=\"http:\/\/boxstarter.org\/WhyBoxstarter\">http:\/\/boxstarter.org\/WhyBoxstarter<\/a><\/p>\n<p><a title=\"https:\/\/chocolatey.org\/\" href=\"https:\/\/chocolatey.org\/\">https:\/\/chocolatey.org\/<\/a><\/p>\n<p>ScottHa 2014 Tool list, including BoxStarter, etc. <a title=\"http:\/\/www.hanselman.com\/blog\/ScottHanselmans2014UltimateDeveloperAndPowerUsersToolListForWindows.aspx\" href=\"http:\/\/www.hanselman.com\/blog\/ScottHanselmans2014UltimateDeveloperAndPowerUsersToolListForWindows.aspx\">http:\/\/www.hanselman.com\/blog\/ScottHanselmans2014UltimateDeveloperAndPowerUsersToolListForWindows.aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Talking last week with Scott Hanselman he showed me in his laptop some cool stuff which is very useful for me as I usually need to re-install my machines pretty often due to the release of new betas and the fact that I prefer to start with clean machines whenever I can. And you know, [&hellip;]<\/p>\n","protected":false},"author":362,"featured_media":12806,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[36],"class_list":["post-23","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cesardelatorre","tag-chocolatey"],"acf":[],"blog_post_summary":"<p>Talking last week with Scott Hanselman he showed me in his laptop some cool stuff which is very useful for me as I usually need to re-install my machines pretty often due to the release of new betas and the fact that I prefer to start with clean machines whenever I can. And you know, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media\/12806"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}