Came across the need to work with collection variables recently with SCCM 2007. This is a feature that is neatly tucked away in the properties of a collection. If you right click on a collection and select 'modify collection settings' we have the option window as shown below.
A collection variable is set for the collection as a whole and is available to all members of a collection. Typically, these variables are used during task sequence execution. If the variable is defined here it is available in the task sequence environment.
When we think about task sequence usage we normally think about OSD imaging. There are several places where collection variables would be useful in conjuction with imaging. Consider one known problem condition you might encounter - loading an XP image to a new hardware set. In some cases, after an XP is loaded to a system and after system restart, we get a blue screen followed by an immediate reboot - and this continues. The image deployed OK - but the system won't boot. In this case, a common cause of the problem is the fact that Windows PE 2.0 (default for SCCM) was used to lay down the image. Windows PE 2.0 has a new way of writing partitions to the disk that is not compatible with some BIOS configurations - such as the BIOS found in HP D530, HP DC 5000 and HP DC 5100 systems. In this case, we must introduce a registry change to the system to allow the system to boot properly after the image is applied. Collection variables provide an easy way to do that - just introduce a collection variable to systems as follows
In this case, SCCM is coded to see this collection variable and add the required registry changes automatically. In other cases, you may have to add the logic to edit the registry or take whatever action is needed when the collection variable is encountered.
I should also point out that a variables to be used by a Task Sequence may also be set in the Task Sequence itself - but collection variable sare also a convenient place.