Skip to content

Instantly share code, notes, and snippets.

@timabell
Last active November 6, 2020 18:29
Show Gist options
  • Save timabell/608fb680bfc920f372ac to your computer and use it in GitHub Desktop.
Save timabell/608fb680bfc920f372ac to your computer and use it in GitHub Desktop.
http://boxstarter.org/ script for .net development in a vm - run it by clicking here: https://is.gd/Zt6ziH
# boxstarter script http://boxstarter.org/
# source: https://gist.github.com/timabell/608fb680bfc920f372ac
# originally tested on win7 x64
# wip on win 10
# dotmatrix (windows branch) https://github.com/timabell/dotmatrix/tree/windows
# powershell profile https://gist.github.com/timabell/56254968905f9066ef88c1ae774a53d1
# This is a start of a build of a box I'm using at the moment.
# Fork this to your own gist, then comment/uncomment/add stuff to suit you.
# Some context: I hate windows, and only use it for work, the rest of the time
# I'm on linux; so when I'm doing client work on my kit that needs windows (I'm
# a .net contract dev) I run windows in virtualbox. As a result this build
# doesn't have a lot of tools you might use like dropbox etc as all that lives
# on my host machine and is all installed with apt-get (see my dotmatrix on
# github for the list).
# I'm also a vim user, so you won't see notepad++ or other common things of that ilk.
# Actually scratch that, notepad++ is too useful for looking into encoding problems.
# To run, click the link in the desription at the top of this gist page.
# This will only work in IE / Edge.
# Alternatively paste this link into internet explorer's address bar and hit enter:
# http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/timabell/608fb680bfc920f372ac/raw/boxstarter.ps1
# or the shortened version:
# https://is.gd/Zt6ziH
# If IE is your default browser you can simply paste into start > run without firing up IE first.
# Install log ends up in C:\Users\tim\AppData\Local\Boxstarter
# Note: last time I checked boxstarter installed an outdated version of chocolatey.
# I've been giving some thought to this approach, and it seems to me that while it's a good start, the variation
# in the needs for building a dev machine for different circumstances is such that you'll spend half your time
# fiddling with these script files to get them right for whatever situation you have on the day. I think we need
# another layer on top that allows you to pick the bits you want at the time, and add extra bits on demand.
# doesn't seem to work on win 10
# https://forums.virtualbox.org/viewtopic.php?f=2&t=65159
# From Event Log: "Display driver VBoxVideoW8 stopped responding and has been successfully disabled."
# cinst VBoxGuestAdditions.install -version 4.3.20
# - latest version, awaiting moderation so have to specify
# needs updating, my virtualbox install provides v4.3.28 which does work with my win10 vm
### folders
# you can run any powershell in this script as boxstarter just runs this as powershell
# somewhere to put code I'm working on
$repoPath = 'c:\repo'
if(!(Test-Path -Path "$repoPath" )){
mkdir "$repoPath"
}
# Allow running scripts (not needed for boxstarter, just useful) http://superuser.com/a/106363/8271
# didn't work on win10
# set-executionpolicy remotesigned -Force
# Windows options: - more options at http://boxstarter.org/WinConfig
### windows UI config
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
# always show all items in system tray
Set-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name EnableAutoTray -Value 0
# turn off stupid integrated CILLIT BING! search in start menu
Set-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Value 0
# turn off annoying snap window suggestion https://www.tekrevue.com/tip/how-to-disable-snap-assist-windows-10/
# settings > multitasking > snap
Set-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name SnapAssist -Value 0
Set-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name JointResize -Value 0
Set-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name SnapFill -Value 0
# disable machine lock (makes no sense on a VM) https://stackoverflow.com/a/10987961/10245
# Key doesn't exist in win10, need to work out how to add it first.
#Set-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name DisableLockWorkstation -Value 1
# use procmon to find more annoying reg key settings, filter to Operation="RegSetValue"
# Keep display on (it's a VM so the host manages the display, it's annoying when the VM goes to sleep too)
# https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc748940(v=ws.10)
powercfg /CHANGE monitor-timeout-dc 0
powercfg /CHANGE monitor-timeout-ac 0
### windows components & config
cinst -source windowsfeatures IIS-WebServerRole IIS-WebServer IIS-Security IIS-WindowsAuthentication
# information on using raw powershell to install windows features: https://www.simple-talk.com/sysadmin/powershell/an-introduction-to-powershell-modules/
# cinst powershell4
# - shouldn't be needed on win 8, but should be harmless, and will upgrade win 7
### programs
# to see the details of any of the following go to https://chocolatey.org/packages/PACKAGE_NAME_HERE
# find more package names here: https://chocolatey.org/
# and here `choco list`
# and here `choco list -source windowsfeatures`
#
cinst chocolatey
cinst au # Chocolatey Automatic Package Updater Module
cinst putty
# Auto-start putty authentication agent (one less thing to do after a reboot)
# https://stackoverflow.com/a/9701907/10245
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\pageant.lnk")
$Shortcut.TargetPath = "C:\ProgramData\chocolatey\bin\pageant.exe"
$Shortcut.Save()
cinst git.install
cinst git-credential-manager-for-windows
cinst kdiff3
cinst vim
cinst gitextensions
cinst editorconfig.core
cinst netcat
# Automatically cache github & gist ssh server keys (gitext/putty/plink)
# Workaround for git bash bug http://stackoverflow.com/q/33240137/10245
# broken, install too old
# https://stackoverflow.com/a/49268200/10245
# https://blog.github.com/2018-02-23-weak-cryptographic-standards-removed/
echo y | & 'C:\ProgramData\chocolatey\bin\plink.exe' -ssh [email protected]
echo y | & 'C:\ProgramData\chocolatey\bin\plink.exe' -ssh [email protected]
echo y | & 'C:\ProgramData\chocolatey\bin\plink.exe' -ssh [email protected]
# plugin manager and other plugins are not available in 64bit notepad++, force 32bit:
cinst notepadplusplus --x86
# https://gist.github.com/timabell/bc90e0808ec1cda173ca09225a16e194
$exts=@(
"csv",
"csproj",
"json",
"log",
"md",
"patch",
"sql",
"txt",
"yml",
"xml")
echo "## setting up file associations"
foreach ($ext in $exts){
$extfile=$ext+"file"
$dotext="." + $ext
cmd /c assoc $dotext=$extfile
cmd /c "ftype $extfile=""C:\Program Files (x86)\Notepad++\notepad++.exe"" %1"
echo ""
}
cinst 7zip # needed to be able to unzip AES encrypted zip files
# firefox defaults to US which causes problems with badly configured javascript calendar popups:
cinst firefox -packageParameters "l=en-GB"
cinst googlechrome
cinst pdfcreator
cinst sumatrapdf
cinst baretail
cinst sysinternals
cinst windirstat
cinst poshgit
# sql server + tools #
cinst mssqlserver2014express
# cinst dotnet3.5 # now installed automatically, dependency of mssqlservermanagementstudio2014express
cinst mssqlservermanagementstudio2014express
# cinst graphviz
# cinst eclipse
# cinst rdcman
# cinst fiddler4 # hidden package for some reason
# IIS-WindowsAuthentication - enable integrated auth in IIS
### big slow installs
# visual studio #
cinst visualstudio2015professional
cinst visualstudio2017professional
# cinst VisualStudio2013Ultimate -InstallArguments "/Features:'WebTools SQL'"
# cinst visualstudio2015community -packageParameters "--Features SQL"
# - 2015 community works, but doesn't upgrade to pro when you enter a key
# package options here:
# https://chocolatey.org/packages/visualstudio2013ultimate
# https://chocolatey.org/packages/visualstudio2015community
# visual studio extensions (vsix)
# these aren't specific to a version vs (in name at least)
cinst editorconfig.vs
cinst vsvim
cinst ihateregions
# cinst webessentials2015 # this has been split up now, todo: use the new ones
# todo: https://visualstudiogallery.msdn.microsoft.com/f3b504c6-0095-42f1-a989-51d5fc2a8459 - web extension pack, used to be part of web essentials
# todo: https://marketplace.visualstudio.com/items?itemName=ErlandR.ReAttach
# vs 2015
# cinst poshtools-visualstudio2015 -version 3.0.177 # install failed, commented on package page
# vs 2013
# cinst visualstudio2013-webessentials.vsxigituh
# cinst poshtools-visualstudio2013
# resharper has to be installed after visual studio otherwise it doesn't show up
# cinst resharper
### notes
# need packaging
# - visual studio addons
# - ghostdoc
# - color-theme editor
# - ready-roll
# redgate data suite
# - twittered, download is behind registration form :-(
# - response! :-) https://twitter.com/DataMacas/status/635723782645284864
# - sql dev suite direct download http://download.red-gate.com/SQLDeveloperSuite.exe 3dd4b1ed4cddf100a3b0f1a4150b16f5
# latest localdb
# need packaging for VS 2015
# - posh tools - powershell editing support in VS
#todo: https://visualstudiogallery.msdn.microsoft.com/46c0c49e-f825-454b-9f6a-48b216797eb5 - Open in External Browser
#todo: https://visualstudiogallery.msdn.microsoft.com/7f960171-9d87-4143-80ad-9e7edaa0d1f3 - xeam Project Rename Tool (untested)
# also worth a look
# - VS "Roaming Extension Manager" Extension:
# https://visualstudiogallery.msdn.microsoft.com/7b421a95-c32c-4433-a2be-a41b276013ab
#todo: https://github.com/Microsoft/Git-Credential-Manager-for-Windows
# config todo:
# dotmatrix - windows branch, clone, checkout, install vimbundles, install config
# git configuration - partially through dotmatrix, prompts for language, no sh configured
# gvim font and colour
# default file extension handling - https://github.com/chriskenis/POSH/blob/master/OS/OS_DefaultAssociations.ps1
# vs keyboard config - resharper, vsvim, other customisations
# vs - reload silently
# customised VS solarized theme, in dotmatrix - needs fixup for vs2015
# disable the screensaver (it's a vm, the host has a timed screen-lock)
# tell windows update to go fuck itself
# set git editor to gvim
# command-prompt-here http://stackoverflow.com/a/7560350/10245
# windows 10
# - knee-cap the privacy destroying auto-web search start box
# host key for github ssh
# ssh key - with putty, not ssh-keygen, add to github
# stuff I can't publish, but not too hard to do manually
# - visual studio sign-in
# - resharper license key
# - firefox sync sign-in - gets all the extensions installed
# - ready-roll license
# - ssh keys: generate with gitextensions/putty, add to bitbucket/github - keep on shared folder outside vm
# - git username / email (could publish it but don't want people committing as me by mistake)
# minor annoyances
# firefox - don't import, set default browser
# setup task bar & start menu
# pin vs to taskbar
# enable kdiff3 quit via esc
# kill crappy IE homepage
# auto-login - password in registry.
# http://www.intowindows.com/how-to-automatically-login-in-windows-10/
# refs and inspirations:
# - http://blog.zerosharp.com/provisioning-a-new-development-machine-with-boxstarter/
# - https://gist.github.com/alexanderfloh/6c53c10a495a41c13388
# - https://gist.github.com/ChaseFlorell/7832733
# - http://www.skylinetechnologies.com/Blog/Blog-Article/Article/2431/Chocolately-and-BoxStarter.aspx
# - https://gist.github.com/jptacek/8099099/
# - http://trycatchfail.com/blog/post/Painless-Workstation-Setup-with-Boxstarter.aspx
# - https://github.com/chocolatey/choco/wiki/DevelopmentEnvironmentSetup
# golang dev requirements
# cinst golang
# cinst mingw
# todo: set $GOPATH
# cinst webpi #broken
github.com,192.30.252.128 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
gist.github.com,192.30.252.141 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
bitbucket.org,131.103.20.167 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==
# tesing ground for additions to main boxstarter build script
# To run, paste this into internet explorer's address bar (doen't work in firefox) and hit enter:
# http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/timabell/608fb680bfc920f372ac/raw/testpad.txt
# or shortened version:
# http://is.gd/jK3dhW
# this is interactive. doh.
# cinst sql2012.localdb
@timabell
Copy link
Author

subsequent run -
resharper v9.2.0.0
Write-Error : Package 'resharper v9.2.0.0' did not install successfully: Exception calling "Start" with "1" argument(s)
: "The system cannot find the file specified"
At C:\Users\tim\AppData\Local\Apps\2.0\54ZX42N8.NDG\YDGT9TW4.5H3\boxs..tion_4b037e62ccd024b7_0002.0005_be57ddd41911ccdf
\Chocolatey\chocolateyinstall\functions\Chocolatey-NuGet.ps1:90 char:17

  • ... Write-Error "Package `'$installedPackageName v$installedP ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

Finished installing 'resharper' and dependencies - if errors not shown in console, none detected. Check log for errors if unsure.
Write-Error : Chocolatey reported an unsuccessful exit code of 1
At line:124 char:21

  • ... Write-Error "Chocolatey reported an unsuccessful exit cod ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

++ Boxstarter finished Calling Boxstarter's vendored Chocolatey to install resharper. This may take several minutes to complete... 00:00:16.6724608

@timabell
Copy link
Author

timabell commented Oct 31, 2016

On azure vm

Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will retain its current effective execution policy of Bypass.

http://stackoverflow.com/questions/27753917/how-do-you-successfully-change-execution-policy-and-enable-execution-of-powershe

run manually in admin powershell first

@timabell
Copy link
Author

win10 log

Boxstarter: Installing package https://gist.githubusercontent.com/timabell/608fb680bfc920f372ac/raw/boxstarter.ps1
Boxstarter Version 2.9.27
(c) 2017 Matt Wrock. http://boxstarter.org

Boxstarter: Disabling Automatic Updates from Windows Update
Attempting to build package from 'tmpB217.tmp.nuspec'.
Successfully created package 'C:\Users\tim\AppData\Local\Apps\2.0\7XH2T4LA.0V8\DYQZ908G.JQR\boxs..tion_6b092740f7261cd0_0002.0009_8212bec7b6369c95\BuildPackages\tmpB217.tmp.1.0.0.nupkg'
Boxstarter: Created a temporary package tmpB217.tmp from https://gist.githubusercontent.com/timabell/608fb680bfc920f372ac/raw/boxstarter.ps1 in C:\Users\tim\AppData\Local\Apps\2.0\7XH2T4LA.0V8\DYQZ908G.JQR\boxs..tion_6b092740f7261cd0_0002.0009_8212bec7b6369c95\BuildPackages
++ Boxstarter starting Calling Chocolatey to install tmpB217.tmp. This may take several minutes to complete...
Installing the following packages:
tmpB217.tmp
By installing you accept licenses for the packages.
[NuGet] Installing 'tmpB217.tmp 1.0.0'.
[NuGet] Successfully installed 'tmpB217.tmp 1.0.0'.

tmpB217.tmp v1.0.0 (forced)
tmpb217.tmp package files install completed. Performing other installation steps.
C:\repo
ERROR: Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope.  Due to the override, your shell will retain its current effective execution policy of Bypass. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information please see "Get-Help Set-ExecutionPolicy".
The install of tmpb217.tmp was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\tmpB217.tmp\tools\ChocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - tmpb217.tmp (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\tmpB217.tmp\tools\ChocolateyInstall.ps1'.
 See log for details.
Chocolatey : Chocolatey reported an unsuccessful exit code of -1. See
C:\Users\tim\AppData\Local\Boxstarter\boxstarter.log for details.
At C:\Users\tim\AppData\Local\Apps\2.0\7XH2T4LA.0V8\DYQZ908G.JQR\boxs..tion_6b092740f7261cd0_0002.0009_8212bec7b6369c95
\Boxstarter.Chocolatey\Invoke-ChocolateyBoxstarter.ps1:201 char:5
+     Chocolatey install $bootstrapPackage -source $source -force:$forc ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,chocolatey

++ Boxstarter finished Calling Chocolatey to install tmpB217.tmp. This may take several minutes to complete... 00:00:07.9629611
True
Boxstarter: Restore Automatic Updates from Windows Update
Type ENTER to exit:

@timabell
Copy link
Author

@timabell
Copy link
Author

chocolatey/boxstarter#307 - powershell policy error

@timabell
Copy link
Author

choco install git.install -params '"/GitOnlyOnPath /NoAutoCrlf"' - from https://gist.github.com/jamesrcounts/1793bc20a01708d85651

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment