Skip to content

Instantly share code, notes, and snippets.

@lucamilan
Forked from ZinkNotTheMetal/mam-boxstarter.ps1
Last active November 9, 2021 16:49
Show Gist options
  • Save lucamilan/7b3f1c53ea66f943c6899777fd7baf55 to your computer and use it in GitHub Desktop.
Save lucamilan/7b3f1c53ea66f943c6899777fd7baf55 to your computer and use it in GitHub Desktop.
MyLaptop2021-BoxStarter
# Invoke using following syntax into IE:
# http://boxstarter.org/package/url?https://gist.githubusercontent.com/lucamilan/7b3f1c53ea66f943c6899777fd7baf55/raw/b7167b7bc0a573944b3b4324538c9762babe0b1a/ml2021-boxstarter.ps1
try {
# Boxstarter options
$Boxstarter.RebootOk = $true
$Boxstarter.NoPassword = $false # Is this a machine with no logon password?
$Boxstarter.AutoLogin = $true
# --- TEMPORARILY DISABLE --- #
Disable-UAC
# --------------------------- #
# Set Windows configuration variables
# https://boxstarter.org/WinConfig
Set-WindowsExplorerOptions -enableshowFileExtensions -enableshowProtectedOSFiles
Disable-BingSearch
Update-ExecutionPolicy Unrestricted
cinst TelnetClient -source windowsFeatures
Write-BoxstarterMessage "Turning off Windows Hibernation"
powercfg -h off
# Install NETFramework Old Version
dism /online /enable-feature /featurename:NetFX3 /all /Source:d:sourcessxs /LimitAccess
# Install Software
cinst googlechrome -y
cinst docker-desktop -y
cinst git -y
cinst kubernetes-cli -y
choco install ditto -y
cinst greenshot -y
cinst 7zip -y
cinst cloc -y
cinst curl -y
cinst fiddler -y
cinst grep -y
cinst logparserstudio -y
cinst notepadplusplus -y
cinst postman -y
cinst putty -y
cinst sysinternals -y
cinst wget -y
cinst winmerge -y
# Visual Studio 2019 - Community
# cinst -y visualstudio2019community --package-parameters "--allWorkloads --includeRecommended --includeOptional --passive --locale en-US"
# Pin - updates itself / chocolatey should not manage updates
# choco pin add -n=visualstudio2019community
# NuGet Package Explorer
# cinst nugetpackageexplorer --limitoutput
# DotNet Core SDK
cinst -y dotnet-5.0-sdk
cinst -y dotnetcore-sdk
# .NET 4.7.2
cinst -y netfx-4.7.2-devpack
# .NET 4.8
choco install dotnetfx
# Tools
dotnet tool install --global dotnet-outdated-tool
dotnet tool install --global dotnet-svcutil
dotnet tool install --global dotnet-ef
# Visual Studio Code
cinst visualstudiocode
# Pin - updates itself / chocolatey should not manage updates
choco pin add -n=visualstudiocode
# Azure CLI
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi
# Microsoft Teams for communication
cinst microsoft-teams.install
# Install Git w/ Configuration
cinst git.install -params '"/GitAndUnixToolsOnPath"' --limitoutput
cinst pwsh -y
cinst poshgit -y
# Run the following command in powershell
#Add-PoshGitToProfile -AllHosts
# Install Visual Studio Extensions
# Any additional extensions here
# Remove Windows 10 Metro Apps
Write-Output "Removing Windows 10 Metro apps..."
Get-AppxPackage Microsoft.549981C3F5F10 | Remove-AppxPackage # Cortana
Get-AppxPackage Microsoft.3DBuilder | Remove-AppxPackage
Get-AppxPackage Microsoft.Microsoft3DViewer | Remove-AppxPackage
Get-AppxPackage Microsoft.Print3D | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsAlarms | Remove-AppxPackage
Get-AppxPackage *Autodesk* | Remove-AppxPackage
Get-AppxPackage *Twitter* | Remove-AppxPackage
Get-AppxPackage *Dropbox* | Remove-AppxPackage
Get-AppxPackage *Netflix* | Remove-AppxPackage
Get-AppxPackage *Solitaire* | Remove-AppxPackage
Get-AppxPackage *Xbox* | Remove-AppxPackage
Get-AppxPackage *Keeper* | Remove-AppxPackage
Get-AppxPackage *Plex* | Remove-AppxPackage
Get-AppxPackage king.com.CandyCrushSaga | Remove-AppxPackage
Get-AppxPackage king.com.BubbleWitch3Saga | Remove-AppxPackage
Get-AppxPackage *McAfee* | Remove-AppxPackage
Get-AppxPackage Microsoft.BingWeather | Remove-AppxPackage
Get-AppxPackage Microsoft.BingNews | Remove-AppxPackage
Get-AppxPackage Microsoft.BingSports | Remove-AppxPackage
Get-AppxPackage Microsoft.BingFinance | Remove-AppxPackage
Get-AppxPackage Microsoft.Wallet | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsCamera | Remove-AppxPackage
Get-AppxPackage Microsoft.CommsPhone | Remove-AppxPackage
Get-AppxPackage Microsoft.Getstarted | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsMaps | Remove-AppxPackage
Get-AppxPackage Microsoft.ScreenSketch | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxApp | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsPhone | Remove-AppxPackage
Get-AppxPackage Microsoft.YourPhone | Remove-AppxPackage
Get-AppxPackage Microsoft.MicrosoftOfficeHub | Remove-AppxPackage
Get-AppxPackage Microsoft.Office.Sway | Remove-AppxPackage
Get-AppxPackage Microsoft.People | Remove-AppxPackage
Get-AppxPackage Microsoft.ZuneMusic | Remove-AppxPackage
Get-AppxPackage Microsoft.ZuneVideo | Remove-AppxPackage
Get-AppxPackage Microsoft.Office.OneNote | Remove-AppxPackage
Get-AppxPackage Microsoft.Windows.Photos | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsSoundRecorder | Remove-AppxPackage
Get-AppxPackage Microsoft.MicrosoftStickyNotes | Remove-AppxPackage
Get-AppxPackage microsoft.windowscommunicationsapps | Remove-AppxPackage
Get-AppxPackage Microsoft.Messaging | Remove-AppxPackage
Get-AppxPackage Microsoft.MixedReality.Portal | Remove-AppxPackage
Get-AppxPackage Microsoft.SkypeApp | Remove-AppxPackage
Get-AppxPackage *GAMELOFTSA.Asphalt8Airborne* | Remove-AppxPackage
Get-AppxPackage *king.com.CandyCrushSodaSaga* | Remove-AppxPackage
Get-AppxPackage *OneConnect* | Remove-AppxPackage
Get-AppxPackage *MarchofEmpires* | Remove-AppxPackage
Get-AppxPackage *PandoraMediaInc* | Remove-AppxPackage
Get-AppxPackage *Houzz* | Remove-AppxPackage
Get-AppxPackage *Viber* | Remove-AppxPackage
# Prevent applications from re-installing
$cdm = @(
"ContentDeliveryAllowed"
"FeatureManagementEnabled"
"OemPreInstalledAppsEnabled"
"PreInstalledAppsEnabled"
"PreInstalledAppsEverEnabled"
"SilentInstalledAppsEnabled"
"SubscribedContent-314559Enabled"
"SubscribedContent-338387Enabled"
"SubscribedContent-338388Enabled"
"SubscribedContent-338389Enabled"
"SubscribedContent-338393Enabled"
"SubscribedContentEnabled"
"SystemPaneSuggestionsEnabled"
)
foreach ($key in $cdm) {
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name $key -Type DWord -Value 0
}
If (-Not (Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent)) {
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent | Out-Null
}
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent -Name DisableWindowsConsumerFeatures -Type DWord -Value 1
Write-Output "Removed Windows 10 Metro apps."
# Start Code - for initialization
# need to launch vscode so user folders are created as we can install extensions
$process = Start-Process code -PassThru
Start-Sleep -s 10
$process.Close()
# C#
code --install-extension ms-dotnettools.csharp
# PowerShell
code --install-extension ms-vscode.PowerShell
# Markdown lint (helps README.md - linting)
code --install-extension DavidAnson.vscode-markdownlint
# Auto open markdown files
code --install-extension hnw.vscode-auto-open-markdown-preview
# Highlight braces with color
code --install-extension naumovs.color-highlight
# Auto close tag
code --install-extension formulahendry.auto-close-tag
# Auto rename tag
code --install-extension formulahendry.auto-rename-tag
# Docker
code --install-extension PeterJausovec.vscode-docker
code --install-extension mrmlnc.vscode-duplicate
# Highlight matching tag
code --install-extension vincaslt.highlight-matching-tag
# IntelliJ keybindings
code --install-extension k--kato.intellij-idea-keybindings
# Visual Studio Code icons
code --install-extension vscode-icons-team.vscode-icons
# Azure Function support
code --install-extension ms-azuretools.vscode-azurefunctions
# Azure Storage support
code --install-extension ms-azuretools.vscode-azurestorage
# NuGet package manager
code --install-extension jmrog.vscode-nuget-package-manager
code --install-extension formulahendry.dotnet-test-explorer
# Setup C:\Work
if (!(Test-Path -Path C:\Work )) {
mkdir C:\Work
cd C:\Work
# Clone projects
}
# enable IIS features
cinst IIS-WebServerRole -source windowsfeatures
cinst IIS-WebServer -source windowsfeatures
cinst IIS-CommonHttpFeatures -source windowsfeatures
cinst IIS-ApplicationDevelopment -source windowsfeatures
cinst IIS-Security -source windowsfeatures
cinst IIS-URLAuthorization -source windowsfeatures
cinst IIS-RequestFiltering -source windowsfeatures
cinst IIS-NetFxExtensibility -source windowsfeatures
cinst IIS-HealthAndDiagnostics -source windowsfeatures
cinst IIS-HttpLogging -source windowsfeatures
cinst IIS-LoggingLibraries -source windowsfeatures
cinst IIS-RequestMonitor -source windowsfeatures
cinst IIS-HttpTracing -source windowsfeatures
cinst IIS-IPSecurity -source windowsfeatures
cinst IIS-Performance -source windowsfeatures
cinst IIS-WebServerManagementTools -source windowsfeatures
cinst IIS-IIS6ManagementCompatibility -source windowsfeatures
cinst IIS-Metabase -source windowsfeatures
cinst IIS-ISAPIExtensions -source windowsfeatures
cinst IIS-ISAPIFilter -source windowsfeatures
cinst IIS-BasicAuthentication -source windowsfeatures
cinst IIS-WindowsAuthentication -source windowsfeatures
cinst IIS-CGI -source windowsfeatures
cinst IIS-ASPNET -source windowsfeatures
cinst IIS-ASP -source windowsfeatures
cinst IIS-HttpCompressionDynamic -source windowsfeatures
cinst IIS-ManagementScriptingTools -source windowsfeatures
cinst IIS-StaticContent -source windowsfeatures
cinst IIS-DefaultDocument -source windowsfeatures
cinst IIS-DirectoryBrowsing -source windowsfeatures
cinst IIS-WebDAV -source windowsfeatures
cinst IIS-ServerSideIncludes -source windowsfeatures
cinst IIS-CustomLogging -source windowsfeatures
cinst IIS-HttpCompressionStatic -source windowsfeatures
cinst IIS-ManagementConsole -source windowsfeatures
cinst IIS-ManagementService -source windowsfeatures
cinst IIS-WMICompatibility -source windowsfeatures
cinst IIS-LegacyScripts -source windowsfeatures
cinst IIS-LegacySnapIn -source windowsfeatures
cinst IIS-FTPServer -source windowsfeatures
cinst IIS-FTPSvc -source windowsfeatures
cinst IIS-FTPExtensibility -source windowsfeatures
cinst IIS-DigestAuthentication -source windowsfeatures
# Remove Desktop Shortcuts
Write-BoxstarterMessage "Removing desktop shortcuts"
Get-ChildItem -Path "C:\Users\*\Desktop\*" -Recurse -Include *.lnk | Remove-Item -Force
# Install Windows Updates
Write-BoxstarterMessage "Running Windows Update"
Install-WindowsUpdate -Full -AcceptEula
# --- UNDO TEMPORARY DISABLE --- #
Enable-UAC
# ------------------------------ #
Write-BoxstarterMessage "Machine is complete!"
Write-BoxstarterMessage "Configure:"
Write-BoxstarterMessage " 1. New Blank File Keymap"
Write-BoxstarterMessage " 2. Open PowerShell do az login"
}
catch {
Write-ChocolateyFailure 'Boxstarter Error: ' $($_.Exception.Message)
throw
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment