Wednesday, November 7, 2018

Fully automated .NET developer machine setup

How to Automate the setup of a .NET development environment.  The powershell script below leverages two FREE Package Management systems: BoxStarter and Chocolatey.  I use scripts like these to set up anything I use from test servers to to my developer machine.

The script will first install both BoxStarter and Chocolatey then it will install multiple packages as well as do some configuration and uninstall some bloatware. Best part about this script is that its completely free, you can run this script and when it finishes, your ready to connect to your source server and start developing. You can even create an uninstall script to set the machine back to the original sate.

To run the sample script below, make sure your connected to the internet, then open a Powershell as Admin and paste the following script:
##### install Package Management software #####
# install choco
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# install Boxstarter
. { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force

#--- Windows Settings ---
Disable-UAC
Disable-BingSearch
Disable-GameBarTips
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions

###### Install #####
# install Stuff
choco install paint.net -y
choco install windirstat -y
choco install googlechrome -y
choco install firefox -y
choco install sysinternals -y
# install DEV Stuff
choco install Visualstudiocode -y
choco install visualstudio2017community -y --allow-empty-checksums
choco install nodejs -y
choco install fiddler4 -y
choco install Microsoft-Hyper-V-All -source windowsFeatures

###### Config #####
# Start Menu: Disable Bing Search Results
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 0

##### Uninstall bloatware #####
Get-AppxPackage Microsoft.BingFinance | Remove-AppxPackage
Get-AppxPackage Microsoft.BingNews | Remove-AppxPackage
Get-AppxPackage Microsoft.BingSports | Remove-AppxPackage
Get-AppxPackage Microsoft.BingWeather | Remove-AppxPackage

Enable-UAC


It should be obvious what packages are being installed in this script, I recommend you not run this script.  You should modify it to suit your specific needs before running.  You can visit the Chocolatey.org to see a full list of available packages (currently 4,665 packages) and visit BoxStarter.org to see a full list of available powershell commandlets and configuration options.

Links to open source projects for BoxStarter and Chocolatey

No comments: