Undocumented Administrative Template File Tricks

There are two tricks I have learnt over the years when writing policy templates. Neither of which seem to be documented by Microsoft, so I have documented them below.

1. If you want to write to the (Default) value, use "" (double quotes).

e.g. VALUENAME ""

2. If you need to place part of a string in double quotes, you will need to define a string variable and use it instead; otherwise you will receive an error when adding it to the GPO.

e.g. Place the following in your policy:

DEFAULT !!UZCOMMAND

Then place the following under the [strings] section:

UZCOMMAND =C:\PROGRA~1\ULTIMA~1.7\uzip.exe "%1"

This will ensure that the double quotes remain around the %1 part of the string. This is important as %1 is an expanding variable that may contain spaces.

If you try to use the following:

DEFAULT "C:\PROGRA~1\ULTIMA~1.7\uzip.exe "%1""

You will get an error when the template is added. This is due to the two lots of double quotes. If you leave the quotes off from around the %1 section, the template is added without any errors.

DEFAULT "C:\PROGRA~1\ULTIMA~1.7\uzip.exe %1"

However, as mentioned above, you need quotes around the %1 simply because it's an expanding variable.

 


    9th April 2007