A collection of PowerShell files for Windows, including common application installation through Chocolatey and npm, and developer-minded Windows configuration defaults.
- Uninstall unwanted Software
- Disable/Remove annoying Windows settings
- Install WSL2
- Automatically configure your taskbar and start-layout
- Install the Software you need
You download my git-repo and execute the bootstrap.ps1 Script.
It copies all needed files into your Powershell directory C:\Users\USER_XY\Documents\WindowsPowerShell and your dotfiles located in the home folder into your Home-Directory.
.
+-- *profile.ps1
+-- bootstrap.ps1
+-- setup
| +-- install.ps1
+-- custom-scripts
| +-- customStartLayout.ps1
| +-- deps.ps1
| +-- windows.ps1
| +-- installwsl2.ps1
| +-- downloadGitRepos.ps1
| +-- LayoutModification.xml
+-- home
| +-- .anyDotFiles
+-- profile-scrip-help
| +-- specific-scripts
| | +-- HELPER-SCRIPTS
| +-- *components.ps1
+-- README.md
+-- LICENSE
Feel free to fork this repo and edit files to fit your needs!
- The
install.ps1Script downloads the git repository and executes thebootstrap.ps1Script (Only needed for gitless usage) - Powershell loads the corresponding profile-scripts (at least the
profile.ps1) and executes them. They run the corresponding components Script located in theprofile-script-helpfolder - The Scripts in the
profile-script-help/specific-scriptsfolder gets executed from the corresponding components Script - The
profile.ps1executes a few Scripts that adds aliases, useful functions and checks for the correct environment variables - The home folder contains all your dotfiles that will be moved to you home directory
- The
custom-scriptsfolder contains useful Scripts for every Windows 10 Setupinstallwsl2.ps1installs the WSL of your choicewindows.ps1removes unwanted Software and configures Windows to your needsdeps.ps1installs all things that you needcustomStartLayout.ps1sets the Taskbar and StartLayout to the settings in theLayoutModification.xml(assuming you installed most of the Software from thedeps.ps1downloadGitRepos.ps1downloads all your repositories. You need to setup a User Token and allow full access to your repos (otherwise only public repos will be downloaded).
- Change files to fit your need!
- Change Execution Policy
- Download the repo and execute the
bootstrap.ps1(Getting started section) - Execute
windows.ps1for cleanup - Check for remaining Software and Settings
- Execute
installwsl2.ps1, restart PC when prompted and execute again - Execute
deps.ps1to install your Software on the fresh configured System - Execute
customStartLayout.ps1to get your predefined StartLayout and Taskbar items
You can clone the repository wherever you want. (I like to keep it in ~\Projects\dotfiles-windows.) The bootstrapper script will copy the files to your PowerShell Profile folder.
From PowerShell:
git clone https://github.com/hoeffjo/automated-windows-setup.git; cd automated-windows-setup; . .\bootstrap.ps1To update your settings, cd into your local automated-windows-setup repository within PowerShell and then:
. .\bootstrap.ps1Note: You must have your execution policy set to unrestricted (or at least in bypass) for this to work: Set-ExecutionPolicy Unrestricted.
Note!!!: You must have your execution policy set to unrestricted (or at least in bypass) for this to work. To set this, run
Set-ExecutionPolicy Unrestrictedfrom a PowerShell running as Administrator.
To install these dotfiles from PowerShell without Git:
iex ((new-object net.webclient).DownloadString('https://raw.github.com/hoeffjo/automated-windows-setup/master/setup/install.ps1'))To update later on, just run that command again.
If .profile-script-help\specific-scripts\extra.ps1 exists, it will be sourced along with the other files. You can use this to add a few custom commands without the need to fork this entire repository, or to add commands you don't want to commit to a public repository.
My .\extra.ps1 looks something like this:
# Hg credentials
# Not in the repository, to prevent people from accidentally committing under my name
Set-Environment "EMAIL" "Jonas Hoefflin <email@example.com>"
# Git credentials
# Not in the repository, to prevent people from accidentally committing under my name
Set-Environment "GIT_AUTHOR_NAME" "Joans Hoefflin","User"
Set-Environment "GIT_COMMITTER_NAME" $env:GIT_AUTHOR_NAME
git config --global user.name $env:GIT_AUTHOR_NAME
Set-Environment "GIT_AUTHOR_EMAIL" "email@example.com"
Set-Environment "GIT_COMMITTER_EMAIL" $env:GIT_AUTHOR_EMAIL
git config --global user.email $env:GIT_AUTHOR_EMAIL
Extras is designed to augment the existing settings and configuration. You could also use ./extra.ps1 to override settings, functions and aliases from my dotfiles repository, but it is probably better to fork this repository.
When setting up a new Windows PC, you may want to set some Windows defaults and features, such as showing hidden files in Windows Explorer and installing IIS. This will also set your machine name and full user name, so you may want to modify this file before executing.
.\windows.ps1
When setting up a new Windows box, you may want to install some common packages, utilities, and dependencies. These could include node.js packages via NPM, Chocolatey packages, Windows Features and Tools, and Visual Studio Extensions from the Visual Studio Gallery.
.\deps.ps1The scripts will install Chocolatey, node.js, and other tools. Check the "Choco Install ..." lines and disable or add what you (don't) need.
To quickly get up and running with WSL2, open a new PowerShell window as "Admin" and run the following one-liner:
.\installwsl2.ps1
You need to run this script twice, one to install pre-requisites and once after the reboot to update the WSl2 kernel and install the distro (Ubuntu 18.04 recommended from MS)
Test if it works with
(Get-VM).Name # Get a list of VM names
Set-VMProcessor -VMName [TestVMName] -ExposeVirtualizationExtensions $true
To Setup your StartLayout and Taskbar the same on every device you can run the following Script:
.\customStartLayout.ps1
It overrides the LayoutModification on your system with the file name LayoutModification.xml (exact name is important). If you want to export your Layout from your current or testing-machine just run the following command:
Export-StartLayout -Path "C:\YOUR_CUSTOM_PATH\LayoutModification.xml"
Put the xml file into the same directory as the script and run it.
This repository is built around how I use Windows and to make my setup easier and the same on all my different devices. If you want to use this on your primary OS, you may want a different configuration that reflects that, and I recommend you fork this repository.
If you do fork for your own custom configuration, you will need to touch a few files to reference your own repository, instead of mine.
Within /setup/install.ps1, modify the Repository variables.
$account = "hoeffjo"
$repo = "automated-windows-setup"
$branch = "master"Within the Windows Defaults file, /custom-scripts/windows.ps1, modify the Machine name on the first line.
(Get-WmiObject Win32_ComputerSystem).Rename("MyMachineName") | Out-NullFinally, be sure to reference your own repository in the git-free installation command.
iex ((new-object net.webclient).DownloadString('https://raw.github.com/$account/$repo/$branch/setup/install.ps1'))
Suggestions/improvements are welcome and encouraged!
-
@Mathias Bynens for his OS X dotfiles, which some things are inspired from.
-
@Jay Harris for his dotfiles-repo, which this repository is modeled after.