|
<#
|
|
Download and install boxstarter from boxstarter.org
|
|
|
|
This is an example configuration meant to be modified extensively
|
|
|
|
Set-ExecutionPolicy Bypass -Scope Process -Force;
|
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1'));
|
|
Get-Boxstarter -Force
|
|
|
|
Boxstarter installs chocolatey
|
|
|
|
Be sure to:
|
|
- Run this script in a normal powershell, not pwsh
|
|
- Change the variable defaults below if your name is not Jonas Avrin
|
|
- Remove or modify configurations as they are likely different from person to person
|
|
|
|
#>
|
|
$USERNAME = $env:USERNAME # Change this if necessary (javrin)
|
|
$EMAIL = $env:EMAIL # Change this to your email ([email protected])
|
|
$GH_USERNAME = $env:GITHUB_USERNAME # Change this to your github username (jawabiscuit)
|
|
|
|
|
|
Disable-UAC
|
|
|
|
# Allow execution of powershell scripts
|
|
Update-ExecutionPolicy Unrestricted
|
|
|
|
# Silencing progress to make downloads faster
|
|
$ProgressPreference = "SilentlyContinue"
|
|
|
|
# No confirmation i.e. --yes
|
|
choco feature enable --name=allowGlobalConfirmation
|
|
|
|
# Disable Microsoft and Windows update
|
|
# Disable-MicrosoftUpdate
|
|
|
|
<#
|
|
System configuration
|
|
#>
|
|
Write-Host "Initial system configuration..." -ForegroundColor Green
|
|
|
|
# Regional Settings
|
|
& "$env:windir\system32\tzutil.exe" /s "Eastern Standard Time"
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sShortDate -Value 'dd MM yy'
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sShortTime -Value 'HH:mm tt'
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sTimeFormat -Value 'HH:mm:ss tt'
|
|
|
|
# Enable developer mode on the system
|
|
Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowDevelopmentWithoutDevLicense -Value 1
|
|
|
|
# Turn off screensaver
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name ScreenSaveActive -Value 0
|
|
|
|
# Disable UAC popups
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name EnableLUA -Value 0 -Force
|
|
|
|
# Update help
|
|
# Update-Help
|
|
|
|
Set-StartScreenOptions -EnableBootToDesktop
|
|
|
|
<#
|
|
Windows configuration
|
|
#>
|
|
Write-Host "Setting Windows options..." -ForegroundColor Green
|
|
|
|
## File Explorer
|
|
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -DisableOpenFileExplorerToQuickAccess -DisableShowRecentFilesInQuickAccess -DisableShowFrequentFoldersInQuickAccess -EnableExpandToOpenFolder -EnableShowRibbon
|
|
|
|
# Other params: -Dock Bottom -Combine Always -AlwaysShowIconsOn -MultiMonitorOn -MultiMonitorMode All -MultiMonitorCombine Always
|
|
Set-BoxstarterTaskbarOptions -Size Small
|
|
|
|
<#
|
|
Chocolatey
|
|
#>
|
|
|
|
Write-Host "Installing tools and utilities..." -ForegroundColor Green
|
|
|
|
# Sys admin utils -- https://docs.microsoft.com/en-us/sysinternals/
|
|
choco install --limitoutput sysinternals
|
|
choco install --limitoutput git.install -params "'/GitAndUnixToolsOnPath /NoAutoCrlf /DefaultBranchName:main /Symlinks'"
|
|
choco install --limitoutput python
|
|
choco install --limitoutput python2
|
|
choco install --limitoutput 7zip.install
|
|
choco install --limitoutput googlechrome
|
|
choco install --limitoutput powershell-core
|
|
choco install --limitoutput ripgrep
|
|
|
|
RefreshEnv
|
|
|
|
|
|
<#
|
|
Git Config
|
|
#>
|
|
|
|
Write-Host "Configuring git..." -ForegroundColor Green
|
|
|
|
[Environment]::SetEnvironmentVariable("HOME", $env:USERPROFILE, "User")
|
|
Set-Item "env:\PATH" "$env:PROGRAMFILES\Git\bin;$env:PATH"
|
|
|
|
git config --global user.name $USERNAME
|
|
git config --global user.email $EMAIL
|
|
git config --global core.autocrlf false
|
|
git config --global core.filemode false
|
|
git config --global core.excludesfile $env:USERPROFILE\.gitignore
|
|
git config --global github.user $GH_USERNAME
|
|
git config --global advise.detachedHead false
|
|
|
|
|
|
<#
|
|
Powershell Utilities
|
|
#>
|
|
|
|
Write-Host "Installing Powershell utilities..." -ForegroundColor Green
|
|
|
|
# Install NuGet -- This needs to come first otherwise user confirmation
|
|
# is necessary and difficult to avoid.
|
|
Write-Output "Installing NuGet package provider"
|
|
Install-PackageProvider -Name NuGet -Scope CurrentUser -Force -Verbose
|
|
|
|
Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted'
|
|
|
|
# Install PowershellGet
|
|
Write-Output "Installing PowershellGet"
|
|
Install-Package -Name PowershellGet -Force -Verbose
|
|
|
|
# Install PackageManagement
|
|
Write-Output "Installing PackageManagement"
|
|
Install-Package -Name PackageManagement -MinimumVersion 1.4.7 -Force -Confirm:$false -Source PSGallery -Verbose
|
|
|
|
## Modules
|
|
Install-Module -Name 7Zip4Powershell -AllowClobber -Force
|
|
Install-Module -Name Carbon -AllowClobber -Force
|
|
Install-Module -Name PowerShellHumanizer -AllowClobber -Force
|
|
|
|
Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Untrusted'
|
|
|
|
|
|
<#
|
|
Utilities
|
|
|
|
Write-Host "Installing system utilities..." -ForegroundColor Green
|
|
#>
|
|
|
|
|
|
<#
|
|
SSH
|
|
#>
|
|
|
|
Write-Host "Installing and configuring SSH..." -ForegroundColor Green
|
|
|
|
# Install the OpenSSH Client
|
|
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
|
|
|
|
# Install the OpenSSH Server
|
|
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
|
|
|
|
# Start the sshd service
|
|
Start-Service sshd
|
|
|
|
# OPTIONAL but recommended:
|
|
Set-Service -Name sshd -StartupType 'Automatic'
|
|
|
|
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
|
|
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
|
|
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
|
|
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
|
|
} else {
|
|
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
|
|
}
|
|
|
|
|
|
<#
|
|
Rez
|
|
#>
|
|
|
|
Write-Host "Rez configuration..." -ForegroundColor Green
|
|
|
|
# Enable remote symlinks
|
|
fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1
|
|
|
|
|
|
# Environment
|
|
if ([Environment]::GetEnvironmentVariable("PYTHONIOENCODING", "Machine").Count -eq "0") {
|
|
[Environment]::SetEnvironmentVariable("PYTHONIOENCODING", "UTF-8", "Machine")
|
|
}
|
|
|
|
if ([Environment]::GetEnvironmentVariable("PYTHONDONTWRITEBYTECODE", "Machine").Count -eq "0") {
|
|
[Environment]::SetEnvironmentVariable("PYTHONDONTWRITEBYTECODE", "1", "Machine")
|
|
}
|
|
|
|
if ([Environment]::GetEnvironmentVariable("SHELL", "Machine").Count -eq "0") {
|
|
[Environment]::SetEnvironmentVariable("SHELL", "$env:PROGRAMFILES\Git\bin\bash.exe", "Machine")
|
|
}
|
|
|
|
|
|
# Use system Python default, experiment changing it to Python 3
|
|
# [Environment]::SetEnvironmentVariable("PATH", "C:\Python27;C:\Python27\Scripts;$env:PATH", "User")
|
|
|
|
|
|
<#
|
|
Cleanup
|
|
#>
|
|
|
|
Write-Host "Cleaning up..." -ForegroundColor Green
|
|
|
|
# Revert No confirmation feature
|
|
choco feature disable --name=allowGlobalConfirmation
|
|
|
|
|
|
<#
|
|
Windows Update
|
|
# Enable Windows update
|
|
#>
|
|
Write-Host "Enabling Windows Update..." -ForegroundColor Green
|
|
|
|
# Enable Microsoft Update
|
|
Enable-MicrosoftUpdate
|
|
|
|
Install-WindowsUpdate -AcceptEula
|
|
|
|
# Re-enable UAC
|
|
Enable-UAC
|
|
|
|
|
|
Write-Host "Finished." -ForegroundColor Green |