Pushing A Time Zone to Secure Remote Worker Client

Pushing A Time Zone to Secure Remote Worker Client.#SRW-KB20

Written by Ines

Last published at: April 22nd, 2021

If you would like to sync the time zones on all your clients under one Device Folder, please set up the following Login Script and the Logoff script in the profile:

Login Script

@echo off
tzutil /g > %userprofile%\time.txt
tzutil /s "Central Standard Time"
exit


Do not forget to set the Type to .bat



To get a list of available time zones, in CMD run the following command:


tzutil /l


What the script does

  1.  Discovers the current time zone and saves the output in the active user's folder as time.txt
  2.  Changes the time zone to what you specify


Logoff script

Because SRW runs on a personal computer, this change is done globally, so we have to change the time zone back to what it was. This is why we have the time.txt in the logon script.

Please enter the following into the logoff script section:

@echo off
set /p tz=< "%userprofile%\time.txt"
tzutil /s "%tz%"
del /f "%userprofile%\time.txt"
exit


Do not forget to set the type to .bat:


What the script does

  1.  Loads the time.txt content into a variable
  2.  changes the time zone using the variable
  3.  deletes the time.txt file


Changes are immediate upon logging into SRW:



And you can see the time zone had changed back when you log off of SRW at the login screen


If you try to find the time.txt file, it's now gone. This is specifically required if the end user changes his machine's time zone at some point outside of SRW. this txt file will keep recreating itself with every start of the session.