Skip to content

Instantly share code, notes, and snippets.

@cicorias
Forked from tylergibson/BoxStart-Dev
Created August 11, 2017 13:41
Show Gist options
  • Save cicorias/0901eb92c19a084710df2868336166a3 to your computer and use it in GitHub Desktop.
Save cicorias/0901eb92c19a084710df2868336166a3 to your computer and use it in GitHub Desktop.
# From PowerShell ADMINISTRATOR session run
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
# Open new PowerSheel Administrator session and run
# $cred=Get-Credential domain\username (can also use [email protected] MSA style username)
# Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/tylergibson/bd7a4c923db6bc0bd0a3ca05473dd4f7/raw -Credential $cred
# Initialize reboot log file
$reboot_log = "C:\installation.rbt"
if ( -not (Test-Path $reboot_log) ) { New-Item $reboot_log -type file }
$reboots = Get-Content $reboot_log
# Boxstarter options
$Boxstarter.RebootOk=$true # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
$Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot
# Basic setup
$section = "BasicSetup"
if(-not ($section -in $reboots)) {
Update-ExecutionPolicy Unrestricted
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Enable-RemoteDesktop
# Taskbar Options if you want to change defaults
# Set-TaskbarOptions -Size Large -Lock -Dock Left Small
}
if (Test-PendingReboot) { Add-Content $reboot_log $section ; Invoke-Reboot }
elseif ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Update Windows and reboot if necessary
$section = "WindowsUpdate"
try {
#Give it a few minutes, may be working on another update?
if ( -not ($section -in $reboots) ) { start-sleep -s 180 }
Install-WindowsUpdate -AcceptEula
}
catch {
# Try one more reboot...
$section = "0x80240016Error"
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Install Subsystem for Linux
$section = "LinuxSubsystem"
if(-not ($section -in $reboots)) {
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
Enable-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online -All -LimitAccess -NoRestart -ErrorAction Stop
# Still need to run `bash` or `lxrun/exe /install /y` manually post install
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Install Choocolatey Tools
$section = "ChocolateyTools"
if(-not ($section -in $reboots)) {
choco install chocolatey
choco install chocolateygui
choco install boxstarter
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section }
# Choco dev tools
$section = "ChocoDevTools1"
if(-not ($section -in $reboots)) {
choco install vcredist2005 --ignore-checksums
choco install vcredist2008 --ignore-checksums
choco install vcredist2010 --ignore-checksums
choco install vcredist2012 --ignore-checksums
choco install vcredist2013 --ignore-checksums
choco install vcredist2015 --ignore-checksums
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section }
# Essentials
$section = "Essentials"
if(-not ($section -in $reboots)) {
choco install notepadplusplus
choco install visualstudiocode --params '"/NoDesktopIcon"'
choco install 7zip
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Webstuff
$section = "Webstuff"
if(-not ($section -in $reboots)) {
choco install googlechrome --ignore-checksums
choco install firefox --ignore-checksums
choco install lastpass
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Open Source Dev
$section = "DotNet"
if(-not ($section -in $reboots)) {
choco install dotnet4.6.2
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
$section = "OSDev"
if(-not ($section -in $reboots)) {
cinst -y git.install
cinst -y poshgit
cinst -y git-credential-winstore
choco install winmerge --ignore-checksums
}
if (Test-PendingReboot) { Add-Content $reboot_log $section ; Invoke-Reboot }
elseif ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Admin Tools
$section = "AdminTools"
if(-not ($section -in $reboots)) {
choco install putty --ignore-checksums
choco install wireshark --ignore-checksums
choco install filezilla --ignore-checksums
choco install winscp --ignore-checksums
choco install windirstat --ignore-checksums
}
if (Test-PendingReboot) { Add-Content $reboot_log $section ; Invoke-Reboot }
elseif ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Misc dev tools
#$section = "MiscDevTools"
#if(-not ($section -in $reboots)) {
# choco install fiddler
# choco install msys2
#}
#if (Test-PendingReboot) { Add-Content $reboot_log $section ; Invoke-Reboot }
#elseif ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Misc Apps
$section = "MiscApps"
if(-not ($section -in $reboots)) {
choco install adobe-creative-cloud
choco install vlc
# choco install ffmpeg --ignore-checksums
choco install javaruntime --ignore-checksums
choco install sysinternals
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Install Visual Studio 2015 Enterprise
$section = "VisualStudio2015"
if(-not ($section -in $reboots)) {
#Uncomment to use custom AdminFile. Very brittle, will often fail.
#choco install visualstudio2015enterprise --ignore-checksums -packageParameters "--AdminFile https://gist.githubusercontent.com/tylergibson/3bc01cb2946a7d5d779b5f313b038f85/raw"
choco install visualstudio2015enterprise --ignore-checksums
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Install Hololens Dev Tools
#$section = "Microsoft Hololens"
#if(-not ($section -in $reboots)) {
# choco install unity
#}
#if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Install Pythons
$section = "Python"
if(-not ($section -in $reboots)) {
$preserve_path = Get-Item env:\Path
choco install python.pypy -y
choco install ironpython -y
choco install python2 -moy --version 2.7.11 --install-arguments '/qn /norestart ALLUSERS=1 TARGETDIR=C:\Python27'
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Install pypi packages
$section = "pip"
if(-not ($section -in $reboots)) {
choco upgrade pip -s Python -y
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
$section = "PypiPackages"
if(-not ($section -in $reboots)) {
choco install virtualenv -s Python
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section }
# Productivity
#$section = "Productivity"
if(-not ($section -in $reboots)) {
choco install office365proplus
choco install slack
}
#if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# Docker
#$section = "Docker"
#if(-not ($section -in $reboots)) {
# choco install Microsoft-Hyper-V-All -source windowsFeatures
# choco install containers -source windowsFeatures
# choco install docker -y
#}
#if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
# VS extensions
$section = "VS Extensions"
if(-not ($section -in $reboots)) {
function ignore_checksums($pkgName, $pkgUrl) {
Write-Host "Ignore Checksums: Installing $($pkgName) from $($pkgUrl)."
set-item env:\ChocolateyAllowEmptyChecksums 'true'
set-item env:\ChocolateyAllowEmptyChecksumsSecure 'true'
install-ChocolateyVsixPackage -PackageName $pkgName -VsixUrl $pkgUrl
}
# ignore_checksums 'Web Essentials 2015.3' 'https://visualstudiogallery.msdn.microsoft.com/ee6e6d8c-c837-41fb-886a-6b50ae2d06a2/file/146119/48/Web%20Essentials%202015.3%20v3.0.235.vsix'
# ignore_checksums 'Bundler & Minifier' 'https://visualstudiogallery.msdn.microsoft.com/9ec27da7-e24b-4d56-8064-fd7e88ac1c40/file/164487/35/Bundler%20%26%20Minifier%20v2.1.279.vsix'
# ignore_checksums 'Web Compiler' 'https://visualstudiogallery.msdn.microsoft.com/3b329021-cd7a-4a01-86fc-714c2d05bb6c/file/164873/41/Web%20Compiler%20v1.11.319.vsix'
# ignore_checksums 'Image Optimizer' 'https://visualstudiogallery.msdn.microsoft.com/a56eddd3-d79b-48ac-8c8f-2db06ade77c3/file/38601/44/Image%20Optimizer%20v3.6.94.vsix'
# ignore_checksums 'Web Analyzer' 'https://visualstudiogallery.msdn.microsoft.com/6edc26d4-47d8-4987-82ee-7c820d79be1d/file/181923/24/Web%20Analyzer%20v1.7.77.vsix'
# ignore_checksums 'Gulp Snippet Pack' 'https://visualstudiogallery.msdn.microsoft.com/9e26d1f9-1baf-4983-8c25-f5f769998d4f/file/205735/3/Gulp%20Snippet%20Pack%20v1.2.5.vsix'
# ignore_checksums 'Grunt Snippet Pack' 'https://visualstudiogallery.msdn.microsoft.com/e88222de-b491-4d15-abf5-db4326200e78/file/207138/5/Grunt%20Snippet%20Pack%20v1.1.6.vsix'
ignore_checksums 'Markdown Editor' 'https://visualstudiogallery.msdn.microsoft.com/eaab33c3-437b-4918-8354-872dfe5d1bfe/file/216970/22/Markdown%20Editor%20v1.9.173.vsix'
ignore_checksums 'File Icons' 'https://visualstudiogallery.msdn.microsoft.com/5e1762e8-a88b-417c-8467-6a65d771cc4e/file/224554/13/File%20Icons%20v1.7.61.vsix'
ignore_checksums 'StopOnFirstBuildError' 'https://visualstudiogallery.msdn.microsoft.com/91aaa139-5d3c-43a7-b39f-369196a84fa5/file/44205/7/StopOnFirstBuildError.vsix'
ignore_checksums 'GitHub Extension for Visual Studio' 'https://visualstudiogallery.msdn.microsoft.com/75be44fb-0794-4391-8865-c3279527e97d/file/159055/25/GitHub.VisualStudio.vsix'
ignore_checksums 'GitFlow for Visual Studio 2015' 'https://visualstudiogallery.msdn.microsoft.com/f5ae0a1d-005f-4a09-a19c-3f46ff30400a/file/154275/11/GitFlowVS.2015.vsix'
ignore_checksums 'PowerShell Tools for Visual Studio 2015' 'https://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597/file/199313/3/PowerShellTools.14.0.vsix'
ignore_checksums 'VSColorOutput' 'https://visualstudiogallery.msdn.microsoft.com/f4d9c2b5-d6d7-4543-a7a5-2d7ebabc2496/file/63103/18/VSColorOutput.vsix'
}
if ( -not ($section -in $reboots) ) { Add-Content $reboot_log $section ; Invoke-Reboot }
$section = "PostInstall"
Install-ChocolateyPinnedTaskBarItem "$($Boxstarter.programFiles86)\Google\Chrome\Application\chrome.exe"
Install-ChocolateyPinnedTaskBarItem "$($Boxstarter.programFiles86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"
#Install-ChocolateyPinnedTaskBarItem "$($env:windir)\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe"
Install-ChocolateyPinnedTaskBarItem "$($Boxstarter.programFiles86)\Notepad++\notepad++.exe"
#Cleanup the disk
# Remove update un-installers
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
# Clean the disk
C:\Windows\System32\cleanmgr.exe /d c:
#Defrag
Optimize-Volume -DriveLetter C
#sdelete -> fill empty with 0
sdelete.exe -z c:
# Cleanup reboot log temp file
Remove-Item $reboot_log -Force
#This box starter script/configuration is adapted from:
#https://gist.githubusercontent.com/benoit74/7d98ed4b958804cac4d8/raw/3195b11b6e533a0df33b950d706ec15e30f38805/BoxStarter-DEV
#from
#https://gist.github.com/JEStaubach/8357aa6c1ff31b271c6cba01afcfab19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment