Time zome script

Today with the need to insure the time zones on all of our remote computers, which can be upwards of 250 machines, is set correctly of the area. I decided to sit sown and write a script that would allow the admin to change the time zone with just the push of a few keys. Once my research was complete the only way I found was to change the registry. So I compiled a registry file for every possible time zone we would be in and since Vista’s entry is different I had to repeat the process. I used errorlevels to determine the actions but couldn’t get the user input to work correctly. It has been quit a while since I have written any real shell scripts so I had to do a little research. It turns out that the choice.com, which allows for user input, had been removed after DOS 6. There are a few work a rounds such as PMChoice but I had an old resource kit that had choice.com in it. Ok with all of the files I needed I went out and wrote the script. Here is a section of the shell script:

@echo off
cls
echo.
echo ——————————————————————
echo OPERATING SYSTEM SELECTION
echo ——————————————————————
echo.
echo.
echo Select one of the options below
echo.
echo 1. XP or Server 2003
echo 2. Vista or Server 2008
echo 3. Exit
echo.
echo.
choice /C:123 “select”
echo.
if “%errorlevel%” == “1” goto XP
if “%errorlevel%” == “2” goto Vista
if “%errorlevel%” == “3” goto end
:XP
echo ——————————————————————
echo CHANGING REMOTE COMPUTER TIME ZONES ON XP
echo ——————————————————————
echo.
echo.
echo Select one of the options below
echo.
echo 1. Eastern Time Zone
echo 2. Central Time Zone
echo 3. Mountain Time Zone
echo 4. Pacific Time Zone
echo 5. Korean Time Zone
echo 6. Germany Time Zone
echo 7. Exit
echo.
echo.
choice /C:1234567 “select”
echo.
if “%errorlevel%” == “1” goto Eastern
if “%errorlevel%” == “2” goto Central
if “%errorlevel%” == “3” goto Mountain
if “%errorlevel%” == “4” goto Pacific
if “%errorlevel%” == “5” goto Korea
if “%errorlevel%” == “6” goto Germany
if “%errorlevel%” == “7” goto end
echo.

The script works great and allows for changing of the time zone on all of the computers on the network. Of course it uses a list of the computers on the network and the choice.com file. I didn’t load the complete script because it would be too long for the post. But it installs the registry files I created changing the time zone. I also made a simple user interface that allows for easy use. I am not an expert, but what I did works. Take a look and tell me what you think.

You may also like...

1 Response

  1. avatar immy says:

    This is pretty cool and I think you did an alright job for the tine zone.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.