Tag Archives: Registry

Configure Windows 10 Blue Light settings with PowerShell

As discussed in the previous post on configuring Lunar Calenders in Windows 10, another interesting feature was also introduced in the 15002 Windows 10 Build: Blue Light Settings. Recently more operating systems have included options for reducing the amount of blue light emitted after sundown. This is easier on your eyes and allows you to fall asleep better at night time.

There are a number of settings that can be configured in the Settings > Display > Blue light settings, settings menu. The settings that can be configured are as follows:

Because automation is a great thing and manually clicking through GUI interfaces is not always optimal I decided to write a PowerShell function to simplify the configuration. For example you could utilize this function to automatically disable the reduced blue light settings when color sensitive work is performed, or lower the amount of blue light emitted as the night progresses. These are some of the actions that the Set-BlueLight function can perform.

To instantly turn of the reduced blue light setting the following code can be run:

1
Set-BlueLight -DisableBlueLight

To enable the reduced color mode and set the color shift to Medium run the following code:

1
Set-BlueLight -EnableBlueLight -ColorTemperature MediumShift

To automatically reduce blue light emitted based on the Day and Night cycle in your geographical location execute this:

1
Set-BlueLight -EnableAutomaticSchedule

The values that are configured by the script are byte arrays in the registry, so it required a bit of reverse engineering to get the values to match the settings in the control panel. The function is currently available on GitHub in my Shared Scripts repository: Set-BlueLight

This function will be added to the CustomizeWindows10 module after I have developed my functional and unit tests to ensure the quality of this function.

For more information about the functions and modules discussed in this article, please refer to the following links:

Links in this Article
GitHub – Set-BlueLight
GitHub – CustomizeWindows10 Module
PowerShellGallery – CustomizeWindows10 Module

 

Share

Enable Lunar Calendar in Windows 10

As I installed the latest build of Windows 10 on my system I read that it was now possible to set the calendar to also display the Lunar Calendar in the calendar overview. Because I like automating stuff I decided to take a look at where this is configured. Note that the steps in this post are based on Windows 10 Build 15002,

It turns out this in configured in the following registry key:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\$$windows.data.lunarcalendar\Current

Interestingly enough, the store cache seems to contain many of the recently released new functionality in Windows 10. At the moment this seems to be the space to watch if you are looking to automate your settings in Windows, although most values are binary so it might take some work to figure out how to configure this.

After setting this value to the three possible options:

  • Off
  • Lunar Calendar with simplified Chinese characters
  • Lunar Calendar with traditional Chinese characters

Unfortunately this because the Data property is a binary string, so this is not that easy to manipulate. The following values correspond with the settings. I will list both the binary strings as well as their base 64 representation.

Settings Byte Array Base64
Off 2,0,0,0,88,33,207,247,241,107,210,1,0,0,0,0,67,66,1,0,16,2,0 AgAAAFghz/fxa9IBAAAAAENCAQAQAgA=
Simplified 2,0,0,0,148,217,114,130,241,107,210,1,0,0,0,0,67,66,1,0,16,4,0 AgAAAJTZcoLxa9IBAAAAAENCAQAQBAA=
Traditional 2,0,0,0,75,55,152,236,241,107,210,1,0,0,0,0,67,66,1,0,16,6,0 AgAAAEs3mOzxa9IBAAAAAENCAQAQBgA=

To simplify settings these values the Set-AdditionalCalendar function that is included in the CustomizeWindows10 module can be used to configured these settings:

To install this module and configure these settings run the following code:

1
2
Install-Module -Name CustomizeWindows10
Set-AdditionalCalendar -Simplified

For more information about the functions and modules discussed in this article, please refer to the following links:

Links in this Article
PowerShellGallery – CustomizeWindows10 Module
GitHub – CustomizeWindows10 Module
GitHub – Set-AdditionalCalendar
Share

Uploaded CustomizeWindows10 Module to PowerShell Gallery

Today I finished another major update to the CustomizeWindows10 module I have been working on together with Jan Egil Ring. This module started as a means for me to configure/tweak Windows 10. When I was experimenting with the various Windows 10 insider builds I found myself configuring the same settings on each deployment and I was looking to simplify this process. The module contains a number of tweaks and configuration options to customize and personalize the Windows 10 experience.

CustomizeWindows10-0.0.0.4

In the past I have uploaded the majority of my scripts and functions to the TechNet Script Gallery, but recently I have started using GitHub as a version control system for my scripts. Eventually I plan to upload my entire collection of scripts to GitHub as it provides the opportunity for easier interaction with a wider community but for now this module is my first experiment with both the PowerShell Gallery as well as GitHub.

The module consists of both a PowerShell module as well as a DSC module to allow complete flexibility when applying these settings. In the following example the module will be used to ensure that hidden files are visible and that file extensions are always shown:

1
2
3
4
Import-Module -Name CustomizeWindows10
Enable-ShowFileExtension
Enable-ShowHiddenFiles
Get-ShowHiddenFiles

CustomizeWindows10-CodeExample

For more information or the direct download links of these scripts please refer to the links below. Feel free to leave a comment either here or to contribute directly on GitHub.

TechNet Script Gallery
My entries in TechNet Script Gallery
Blog.PowerShell.No – Jan Egil Ring
JaapBrasser.com – Scripts
GitHub – CustomizeWindows10
PowerShellGallery – CustomizeWindows10
TechNet Script Gallery – CustomizeWindows10

 

Share

New article on PowerShell Magazine: Access remote registry using PowerShell

My latest article on PowerShell Magazine is on how to access the registry on a remote system. This is a technique I have used in a number of my scripts, for example: Get-RemoteProgram. The full article containing tips on how to use the Microsoft.Win32.Registry class is available on PowerShell Magazine : Access remote registry using PowerShell

The following example will retrieve the SubKeyNames of HKLM:\System\CurrentControlSet on the Server1 system:

1
2
3
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,'Server1') 
$RegSubKey = $Reg.OpenSubKey("System\CurrentControlSet")
$RegSubKey.GetSubKeyNames()

Win32RegistryKey

For more articles like this, have a look at the External Articles section of my blog, it contains all the articles I have posted on external sources such as PowerShell Magazine.

Links in this Article
PSTip: Access remote registry using PowerShell
PowerShell Magazine
External Articles
Get-RemoteProgram
My entries in TechNet Script Gallery

 

Share

Update to Get-RemoteProgram – Get list of installed programs on remote or local computer

Over the weekend I have taken a look at the request and current functionality of my Get-RemoteProgram script. A script that gathers the installed programs installed on the local or remote systems by querying the registry and displaying the results to the console as PowerShell objects.

Get-RemoteProgram – Get list of installed programs on remote or local computer

Three new improvements have been implemented to the script:

  • Correctly searches the Wow6432Node for 32 bit applications on 64 bit systems
  • Added a new parameter -Property to specify additional properties to be loaded from the registry
  • Added support for the pipeline to be used to supply the function with computer names

The new parameter -Property is the biggest change to this script, this for example allows direct un-installation based on the output of Get-RemoteProgram, for example:

Get-RemoteProgram -Property UninstallString |
Where-Object {$_.ProgramName -match 'java'} | ForEach-Object {
    cmd /c $_.uninstallstring
}

Here are some additional examples of how the script can be used:

.EXAMPLE
Get-RemoteProgram

Description:
Will generate a list of installed programs on local machine

.EXAMPLE
Get-RemoteProgram -ComputerName server01,server02

Description:
Will generate a list of installed programs on server01 and server02

.EXAMPLE
Get-RemoteProgram -ComputerName Server01 -Property DisplayVersion,VersionMajor

Description:
Will gather the list of programs from Server01 and attempts to retrieve the displayversion and versionmajor subkeys from the registry for each installed program

.EXAMPLE
'server01','server02' | Get-RemoteProgram -Property Uninstallstring

Description
Will retrieve the installed programs on server01/02 that are passed on to the function through the pipeline and also retrieves the uninstall string for each program
Share

New article on PowerShell Magazine: Get a list of all Com objects available

I recently wrote a short function to gather all available Com Objects from the registry and display the list of all objects using PowerShell. I wrote a short article on how this work on PowerShell Magazine, have a look at it here:

http://www.powershellmagazine.com/2013/06/27/pstip-get-a-list-of-all-com-objects-available/

The function is available for download in the Technet Scripting Gallery:

http://gallery.technet.microsoft.com/Get-ComObject-Function-to-50a92047

 

Share

New article on PowerShell Magazine: Using UNC paths when working with PowerShell providers

The article explains two solutions to errors that you might run in to when utilizing UNC paths when working PowerShell providers. For example the execution of the following command will fail:

Set-Location HKLM:
Get-ChildItem | Export-Csv -Path \\localhost\c$\registry.csv

This can be solved by adding the specific provider, in this case the FileSystem PowerShell provider:

Get-ChildItem | Export-Csv -Path Microsoft.PowerShell.Core\FileSystem::\\localhost\c$\registry.csv

For more information on this topic head on over to PowerShell Magazine to have a look at the article:
http://www.powershellmagazine.com/2012/11/05/pstip-using-unc-paths-when-working-with-powershell-providers/

Share