Skip to content

Instantly share code, notes, and snippets.

@ian-noble
Last active December 18, 2018 18:47
Show Gist options
  • Save ian-noble/845bbc91031dca267c9004191ea3b1a1 to your computer and use it in GitHub Desktop.
Save ian-noble/845bbc91031dca267c9004191ea3b1a1 to your computer and use it in GitHub Desktop.
<#
.SYNOPSIS
BoxStarter script to configure Windows bastion host.
.DESCRIPTION
Install BoxStarter:
. { Invoke-WebRequest -useb http://boxstarter.org/bootstrapper.ps1 } | Invoke-Expression; get-boxstarter -Force
Run by calling the following from an **elevated** command-prompt.
Remove -DisableReboots parameter to allow the script to reboot as required.
Install-BoxstarterPackage -PackageName <URL-TO-RAW-GIST> -DisableReboots
.NOTES
Author : Ian Noble
Created: 2018-12-18
#>
Write-Verbose "Trust PSGallery"
Get-PackageProvider -Name NuGet -ForceBootstrap
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Write-Verbose "Install PowerShell Get"
Install-Module -Name PowerShellGet -force
Write-Verbose "Install Fonts: SourceCodePro"
choco upgrade sourcecodepro -y
Write-Verbose "Configure Windows: Explorer Options"
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableShowHiddenFilesFoldersDrives -EnableShowFullPathInTitleBar
Write-Verbose "Configure Windows: Taskbar"
Set-TaskbarOptions -Size Small -Dock Top -Combine Full -AlwaysShowIconsOn
Write-Verbose "Remove AzureRM and Azure module if installed"
$versions = (get-installedmodule AzureRM -AllVersions -ErrorAction SilentlyContinue | Select-Object Version)
$versions | foreach { Uninstall-AllModules -TargetModule AzureRM -Version ($_.Version) -Force }
Uninstall-Module -Name Azure -Force -ErrorAction SilentlyContinue
Write-Verbose "Installing Azure PowerShell module (Az)"
Install-Module -Name Az -AllowClobber
Update-Module -Name Az
Write-Verbose "Enable Az to AzureRM aliases"
Enable-AzureRmAlias
Write-Verbose "Install Microsoft Azure Storage Explorer"
choco upgrade microsoftazurestorageexplorer -y
Write-Verbose "Installing AWS CLI"
choco upgrade awscli -y
Write-Verbose "Installing Terraform"
choco upgrade terraform -y
Write-Verbose "Uninstall 3D Builder"
Get-AppxPackage Microsoft.3DBuilder | Remove-AppxPackage
Write-Verbose "Uninstall Alarms"
Get-AppxPackage Microsoft.WindowsAlarms | Remove-AppxPackage
Write-Verbose "Disable PowerShell v2"
Disable-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2Root
Write-Verbose "Disable SMBv1"
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol
Write-Verbose "Disable GameBarTips"
Disable-GameBarTips
Write-Verbose "Uninstall Bing Finance, News, Sports & Weather"
Get-AppxPackage Microsoft.BingFinance | Remove-AppxPackage
Get-AppxPackage Microsoft.BingNews | Remove-AppxPackage
Get-AppxPackage Microsoft.BingSports | Remove-AppxPackage
Get-AppxPackage Microsoft.BingWeather | Remove-AppxPackage
Write-Verbose "Uninstall Unrequired Windows 10 Store Apps"
Get-AppxPackage *BubbleWitch* | Remove-AppxPackage
Get-AppxPackage king.com.CandyCrush* | Remove-AppxPackage
Get-AppxPackage Microsoft.CommsPhone | Remove-AppxPackage
Get-AppxPackage microsoft.windowscommunicationsapps | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsMaps | Remove-AppxPackage
Get-AppxPackage Microsoft.Messaging | Remove-AppxPackage
Get-AppxPackage Microsoft.People | Remove-AppxPackage
Get-AppxPackage Microsoft.Windows.Photos | Remove-AppxPackage
Get-AppxPackage Microsoft.SkypeApp | Remove-AppxPackage
Get-AppxPackage *Solitaire* | Remove-AppxPackage
Get-AppxPackage Microsoft.Office.Sway | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxApp | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxIdentityProvider | Remove-AppxPackage
Get-AppxPackage Microsoft.ZuneMusic | Remove-AppxPackage
Get-AppxPackage Microsoft.ZuneVideo | Remove-AppxPackage
Write-Verbose "Disable Xbox Gamebar"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name AppCaptureEnabled -Type DWord -Value 0
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name GameDVR_Enabled -Type DWord -Value 0
Write-Verbose "Turn off People in Taskbar"
If (-Not (Test-Path "HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People")) {
New-Item -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People | Out-Null
}
Set-ItemProperty -Path "HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name PeopleBand -Type DWord -Value 0
Write-Verbose "Install NuGet Package Explorer"
choco upgrade nugetpackageexplorer
if (test-path (Join-Path ([Environment]::GetFolderPath("Desktop")) "NugetPackageExplorer.exe.lnk")) {
Move-Item (Join-Path ([Environment]::GetFolderPath("Desktop")) "NugetPackageExplorer.exe.lnk") (Join-Path ([Environment]::GetEnvironmentVariable("AppData")) "Microsoft\Windows\Start Menu\Programs\NugetPackageExplorer.lnk")
}
Write-Verbose "Check for / install Windows Updates"
Enable-MicrosoftUpdate
Install-WindowsUpdate -acceptEula
Write-Output "Complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment