Configuring Windows 10 language and wake settings using Powershell
One of the annoying things about installing new builds of Windows 10 is that the installation process resets a number of settings to default. When you’re on the insider preview “fast ring”, new builds come every 1-2 weeks, and changing those handful of things back to their previous setting gets old pretty fast. After installing a new build today I finally decided to try automating these things using Powershell.
For me, there are 3 main things that I keep changing back after every build:
- Removing unwanted language packs.
Installing the en-AU speech pack so that Cortana works properly.Edit: as of an insider build delivered sometime in May 2016, this now happens automatically.- Disabling devices from waking my computer from sleep.
Unfortunately, I haven’t been able to figure out how to achieve the second one through Powershell (If I do, I’ll update the article), but the first one and last ones weren’t too tricky.
Removing unwanted language packs
Every time I install a new insider build, it automatically re-installs the en-US language. I’m in Australia and only want en-AU installed. The following Powershell code removes all language packs except the one you specify:
1# Uninstall en-US language
2Import-Module International
3Set-WinUserLanguageList en-AU -Force
The only tricky part about that was figuring out how to remove an installed language. My first thought was trying to use Get-WinUserLanguageList en-US
and then piping it to Remove-WinUserLanguageList
… but that cmdlet doesn’t exist. It turns out that Set-WinUserLanguageList
will remove all language packs except the one(s) you’re specifying.
Disabling devices from waking my computer from sleep
Every time I install a new insider build, it re-enables the option that allows my keyboard, mouse, and NIC to wake the computer from sleep. This often means that I will put the computer to sleep, and it will then wake up later on because I bumped the mouse or because something tried to ping it over the network. Since I have configured my power management options to never automatically put the computer to sleep, this typically means the computer will wake up and run for hours before I notice.
Thankfully, there is a command-line utility called powercfg that can be used to query all devices which are allowed to wake the PC. This is basically all devices in the device manager which have the Allow this device to wake the computer box checked under the power management tab. We can then use Powershell to disable that option for each device which has been detected as wake armed.
1# Disable devices armed to wake the computer
2$Devices = (powercfg /devicequery wake_armed)
3if ($Devices -ne "NONE") {
4 foreach ($Device in $Devices) {
5 (powercfg /devicedisablewake $Device)
6 }
7}
Note that the powershell script will have to be run in administrative mode to have the necessary permission to disable the wake-armed devices.
Now that’s all scripted I’ve saved myself about 30 seconds every 1-2 weeks when a new insider build gets installed. I’ll have to install about 120 insider builds to break even on the time spent working out this script and writing this blog post. Hooray.
comments powered by Disqus