Exporting/Importing Time Zone settings using VMware UEM
There was a post in the VMware User Environment Manager VMTN forum regarding a Windows 10 VDI environment in which the time zone settings needed to be saved. Time zone settings are saved on computer level in the HKEY_LOCAL_MACHINE part of the registry. I found a solution for saving these settings using two PowerShell scripts and a VMware UEM config file, which I will describe in this post.
Prerequisites
- VDI or FAT client (no multi-user, like RDSH or XenApp)
- Windows 10 (tested with 1607 and 1703)
TimeZone_Export.ps1
I created a PowerShell script for exporting the time zone information to the HKEY_CURRENT_USER part of the registry (TimeZone_Export.ps1).
1 2 3 4 |
$registryPath = "HKCU:\TimeZone" New-Item -Path $registryPath -Force New-ItemProperty -Path $registryPath -Name Id -Value (Get-TimeZone).Id -Force |
You can put this file somewhere on a file share or in you base VDI image.
TimeZone_Import.ps1
I created a PowerShell script for importing the time zone information (TimeZone_Import.ps1).
1 2 3 4 5 6 7 8 9 10 11 |
$registryPath = "HKCU:\TimeZone" $registryValue = "Id" Do { Start-Sleep -Seconds 2 } Until (((Get-Item -Path $registrypath).GetValue($registryValue) -ne $null) -eq $True) $Id = (Get-ItemProperty -Path $registryPath).Id Set-TimeZone -Id $Id |
You can put this file somewhere on a file share or in you base VDI image.
TimeZone.ini
I created a VMware UEM Config File for exporting/importing the time zone information from the registry (TimeZone.ini).
1 2 |
[IncludeIndividualRegistryKeys] HKCU\TimeZone |
Putting it all together
Use the steps below for putting the configuration together in VMware UEM.
Step 1 – Create a Logoff Task
Create a Logoff Task and use the following command:
1 |
powershell.exe -ExecutionPolicy bypass -file \\server\share\timezone_export.ps1 |
Also make sure you select Run task: Before profile archive export
Step 2 – Create a Logoff Task
Create a Logoff Task and use the following command:
1 |
powershell.exe -ExecutionPolicy bypass -file \\server\share\timezone_import.ps1 |
Also make sure you select Run task: After profile archive import and select Run asynchronously
Step 3 – Configure the TimeZone.ini Config File
Create the TimeZone.ini config file using the content below.
1 2 |
[IncludeIndividualRegistryKeys] HKCU\TimeZone |
That’s it. You should now be able to export/import (roam) time zone settings.