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:
To enable the reduced color mode and set the color shift to Medium run the following code:
To automatically reduce blue light emitted based on the Day and Night cycle in your geographical location execute this:
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:
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:
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.
As I was looking into some errors in my event log I found that I had a number of certificate errors in the event log. In order to investigate this further I wanted to take a look at the certificate in the event log. There are a number of tools available to extract this from the event log but I wanted to be able to automate this in the future so I settled on writing this in PowerShell.
I had the following events in my system event log:
The interesting portion is what is stored in the XML, specifically EventData – Binary:
In order to retrieve this event using PowerShell we can run the following code:
The binary data is encoded as pairs of hexadecimal numbers, so this needs to be converted before we can write this to disk. In order to do this we split the string into pairs of two and then do a conversion using the ToByte method of the System.Convert class:
Now that we have PowerShell output an array of bytes we are ready to write the output of the event log to file. Because we know this should be a certificate all we have to do is write this to a .cer file and we will have a working certificate:
Now the following functional certificate will be available on the desktop:
So there we have it, in this article we have identified the event that contains a certificate that. Afterwards we went into the xml of this event and retrieved the binary eventdata, converted this to a byte array and then wrote this to file.