Saturday 21 November 2009

Date and Time using GPO


How to use a GPO with a customized ADM file to force a specific date and time format.

 
 

Group policy management is one of the tools for Administrators that, in my experience, is not being used to its full potential enough. To name one example: publishing software (not assigning!) is something I do not see very often, even though it potentially is a great way of rolling out less 'business- critical' software. The problem there is that users are involved to do the install using add and remove software (or programs and features in Vista), and that may be where 'the train stops' since there would be extra training involved (or a decent intranet website with examples and video tutorials). Which of course take extra resources, money and time.

This article however covers a piece of Group Policy Management that does not involve training any users, so there's no reason not to deploy it (in your lab environment first ;-) This article targets MCSE level administrators, in particular; it extends on exam 70-294.

As I'm sure you know, it's possible to use .adm files (Administrative Template files) to make changes to systems available through Group Policies. In fact, I'm pretty sure most admins are familiar with the 'wuau.adm' file, which is the administrative template file for WSUS.

There's a lot more that can be done with these administrative templates! Actually, just about anything that can be changed by making registry changes can be made 'distributable' through Group Policies this way. The .adm files allow for a nice user-friendly interface to be 'generated' and this way make your changes available and usable to peer administrators in your organization. Keep a few things in mind though; first of all, be very careful when using localized versions of Windows. And secondly, always pilot your group policies. With that in mind it is always wise to first thoroughly test your new GPO's in the lab.

 
 

How to change time and date

 
 

In the example we'll be making an administrative template that allows for a specific date and time format to be forced on the OU (or domain or site) where the GPO is applied.

To be precise; we'll be making an .adm file that forces: 'dd.MM.yyyy' for date and 'HH:mm:ss' for time.

First we create .adm template so that these can be added to the group policy.

We'll skip the exact details of the creation of the .adm file, especially since Microsoft already has an excellent article online that gets you started quickly and has references for people wanting to try advanced features. For now we'll use the templates I have provided here, and if you're tempted to try your own implementations, make sure to visit the previously mentioned link as well as this one.

Once created the files will be put in the following location %SystemRoot%\inf (usually c:\windows\inf) on the domain controller where we apply the templates.

Filename: GP-Date-Edits.adm (or whatever you would like to call it)

Contains:


CLASS USER

 
 

CATEGORY "Control Panel"

CATEGORY "Regional Settings"

     POLICY "Specify Date Settings"

    KEYNAME "Control Panel\International"

            EXPLAIN !!expSetDateFormat

PART "Short date style" DROPDOWNLIST REQUIRED

VALUENAME "sShortDate"

ITEMLIST

    NAME "M/d/yy"     VALUE "M/d/yy"

    NAME "M/d/yyyy"     VALUE "M/d/yyyy"

    NAME "MM/dd/yy"     VALUE "MM/dd/yy"

    NAME "MM/dd/yyyy"     VALUE "MM/dd/yyyy"

    NAME "yy/MM/dd"     VALUE "yy/MM/dd"

    NAME "dd-MMM-yy"     VALUE "dd-MMM-yy"

                    NAME "dd.MM.yyyy"        VALUE "dd.MM.yyyy" DEFAULT

END ITEMLIST

END PART

PART "Long date style" DROPDOWNLIST REQUIRED

VALUENAME "sLongDate"

ITEMLIST

                NAME "dddd d MMMM yyyy"        VALUE "dddd d MMMM yyyy" DEFAULT

NAME "dddd MMMM dd, yyyy" VALUE "dddd MMMM dd yyyy"

NAME "MMMM dd yyyy" VALUE "MMMMdd yyyy"

NAME "dddd dd MMMM yyyy" VALUE "dddddd MMMM, yyyy"

NAME "dd MMMM yyyy" VALUE "dd MMMM yyyy"

END ITEMLIST

END PART

END POLICY

END CATEGORY

END CATEGORY

[strings]

expSetDateFormat="Specifies the format for client default date format"

 
 

 
 

Now we can apply the .adm file.

 
 

Note that in the group policy editor on the menu "view" and "filter" the following should be disabled:

"Only show policy settings that can be fully managed"



 
 

If this is not disabled, the manual GP settings will not show up.

Now we add the .adm file as a template on the (in this example) Citrix Server GPO, to do this right-click on the Administrative Templates and choose 'Add/remove templates':




 
 

Clicking 'add' allows you to add our template. This adds our custom created date possibility:



(notice all the different formats we defined in the template?)

Once applied we can see it in the 'settings' overview:




I promised we would do time as well as date…: For the time format the procedure is the same, but the .adm file could contain something like:

CLASS USER

 
 

CATEGORY "Control Panel"

CATEGORY "Regional Settings"

     POLICY "Specify Time Settings"

    KEYNAME "Control Panel\International"

            EXPLAIN !!expSetTimeFormat

PART "Short date style" DROPDOWNLIST REQUIRED

VALUENAME "sTimeFormat"

ITEMLIST

                NAME 24-Hour     VALUE "HH:mm:ss" DEFAULT

                NAME 12-Hour     VALUE "H:mm:ss"

END ITEMLIST

END PART

END POLICY

END CATEGORY

END CATEGORY

[strings]

expSetTimeFormat="Specifies the format for client default time format"

0 comments:

Post a Comment