Automated setup of Windows 10 through Boxstarter/Chocolatey/etc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

101 lines
4.1 KiB

# Boxstarter script for my portable Windows To Go install
# Workaround for https://github.com/chocolatey/boxstarter/issues/241
$cache = "--cacheLocation=`"$env:userprofile\AppData\Local\ChocoCache`""
# We don't have to always validate UAC during this script run
Disable-UAC
# Ensure installing powershell modules don't prompt on needed dependencies
$ConfirmPreference = "None"
# Upgrade chocolatey itself
choco upgrade -y $cache chocolatey
# Common dependencies
choco upgrade -y $cache dotnet3.5
# Drivers
choco upgrade -y $cache nvidia-display-driver --version=425.31 --params "'/HDAudio'" # Latest version supporting the 670MX
# Utilities
choco upgrade -y $cache 7zip.install
choco upgrade -y $cache k-litecodecpackbasic
choco upgrade -y $cache wiztree
choco upgrade -y $cache gnupg
choco upgrade -y $cache git.install --params "/GitOnlyOnPath /NoAutoCrlf /WindowsTerminal /NoShellIntegration /NoCredentialManager"
choco upgrade -y $cache qtpass
# Refresh the environment to get access to gpg/git commands
refreshenv
# Import GPG key
gpg --keyserver hkp://pool.sks-keyservers.net --recv-key EE27143FD4C1C95A86B4D83D806539FA8D18CA37
#The key needs to be trusted manually! With `gpg --edit-key EE27143FD4C1C95A86B4D83D806539FA8D18CA37` - `trust` - `5` - `save`
# Setup SSH key for pass
if (-not (Test-Path -Path "$env:userprofile\.ssh" -PathType Container)) {
mkdir "$env:userprofile\.ssh"
curl -UseBasicParsing https://git.axel.tripier.fr/GoFish/boxstarter-win10/raw/branch/master/windows_to_go_ssh_pass_ed25519.asc | gpg -d > "$env:userprofile\.ssh\windows_to_go_ssh_pass_ed25519"
}
# Clone pass repo for QtPass
set GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $env:userprofile\.ssh\windows_to_go_ssh_pass_ed25519"
if (Test-Path -Path "$env:userprofile\password-store" -PathType Container) {
cd "$env:userprofile\password-store"
git pull
} else {
git clone ssh://git@git.axel.tripier.fr:2225/GoFish/pass-store.git "$env:userprofile\password-store"
}
# Browser
choco upgrade -y $cache firefox --params "/l:en-US /NoTaskbarShortcut /NoDesktopShortcut"
choco upgrade -y $cache setdefaultbrowser
SetDefaultBrowser HKLM Firefox-308046B0AF4A39CB
# Chat
choco upgrade -y $cache discord
# Games
#choco upgrade -y $cache leagueoflegendseuw --ignore-checksum
#Note: Battle.net needs to be manually installed!
# Install Microsoft updates
Enable-MicrosoftUpdate
Install-WindowsUpdate -acceptEula -criteria "IsHidden=0 and IsInstalled=0" # Also install non-critical and non-Software updates
# Rename the computer
$computername = "GoFish-WinToGo"
if ($env:computername -ne $computername) {
Rename-Computer -NewName $computername -Restart
}
# Re-enable UAC
Enable-UAC
# Power profile
## Set power plan to high performances
powercfg /setactive scheme_min
## Unhide "Lid close action" in plan advanced power settings
powercfg -attributes sub_buttons lidaction -attrib_hide
## Unhide "Power button action" in plan advanced power settings
powercfg -attributes sub_buttons pbuttonaction -attrib_hide
## Do not sleep when lid is closed. This will not change the value in "Control Panel\Hardware and Sound\Power Options\System Settings", but it will still work.
powercfg /setacvalueindex scheme_current sub_buttons lidaction 0
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 0
## Do not sleep when power button is pressed. This will not change the value in "Control Panel\Hardware and Sound\Power Options\System Settings", but it will still work.
powercfg /setacvalueindex scheme_current sub_buttons pbuttonaction 0
powercfg /setdcvalueindex scheme_current sub_buttons pbuttonaction 0
## Turn off display after 30 minutes of inactivity on AC
powercfg /setacvalueindex scheme_current sub_video videoidle 1800
## Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
# Force remove of the hiberfil.sys file even if hibernation is already disabled in Win2Go
powercfg /hibernate off
# Set available keyboard inputs
Set-WinUserLanguageList -LanguageList en-US, fr-FR -Force
# Set how dates/times/etc. are displayed
Set-Culture -CultureInfo fr-FR
# Set the timezone to Paris
Set-TimeZone -Id "Romance Standard Time"