Managing target device Personality
Normally, all target device’s sharing the same virtual disk must have identical configurations. The Target Device Personality feature allows you to define data for specific target devices and make it available to the target device at boot time. This data can then be used by your custom applications and scripts for various purposes.
For example, suppose you are using Provisioning Server to support PCs in three classrooms. Each classroom has its own printer, and you want the PCs in each classroom to default to the correct printer. By using the Target Device Personality feature, you can define a default printer field, and then enter a printer name value for each target device. You define the field and values under Target Device Properties. This information is stored in the database. When the target device boots, the device-specific printer information is retrieved from the database and written to an .INI file on the virtual disk. Using a custom script or application that you develop, you can retrieve the printer value and write it to the registry. Using this method, each time a target device boots, it is set to use the correct default printer in its classroom.
The number of fields and amount of data that you can define for each target device is limited to 64 Kb or 65536 bytes per target device. Each individual field may be up to 2047 bytes.
Target Device Personality Tasks
- Define personality data for a single target device using the Console
- Define personality data for multiple target devices using the Console
- Using Target Device Personality Data
Define personality data from a single target device using the Console
To define personality data for a single target device:
- In the Console, right-click on the target device that you want to define personality data for, then select the Properties menu option.
- Select the Personality tab.
- Click the Add button. The Add/Edit Personality String dialog appears. Note: There is no fixed limit to the number of field names and associated strings you can add. However, the limits to the total amount of personality data assigned to a single string (names and data combined) is approximately 2047 bytes. Also, the total amount of data contained in names, strings and delimiters is limited to approximately 64 Kb or 65536 bytes per target device. This limit is checked by the administrator when you attempt to add a string. If you exceed the limit, a warning message displays and you are prevented from creating an invalid configuration. Target device personality data is treated like all other properties. This data will be inherited when new target devices are added automatically to the database by either the Add New Target Device Silently option, or with the Add New Target Device with BIOS Prompts option.
- Enter a name and string value. Note: You can use any name for the field Name, but you cannot repeat a field name in the same target device. Field names are not case sensitive. In other words, the system interprets “FIELDNAME” and “fieldname” as the same name. Blank spaces entered before or after the field name are automatically removed. A personality name cannot start with a $. This symbol is used for reserved values such as $DiskName and $WriteCacheType.
- Click OK.
To add additional fields and values, repeat Steps 5 and 6 as needed. When finished adding data, click OK to exit the Target Device Properties dialog.
Define personality data for multiple target devices using the Console
Define target device personality for multiple devices:
- In the Console, right-click on the target device that has the personality settings that you want to share with other device, then select Copy. The Copy device properties dialog appears.
- Highlight the target devices in the details pane that you want to copy personality settings to, then right-click and select the Paste device properties menu.
- Click on the Personality strings option (you may also choose to copy other properties at this time), then click Paste.
Using Target Device Personality Data
Once the file system becomes available to the target device, the personality data is written to a standard Windows .ini text file called Personality.ini. The file is stored in the root directory of the virtual disk file system for easy access by your custom scripts or applications.
The file is formatted as follows:
[StringData] FieldName1=Field data for first field FieldName2=Field data for second field <!--NeedCopy-->
This file is accessible to any custom script or application. It can be queried by the standard Windows .INI API. Additionally, a command line application, called GetPersonality.exe, is provided to allow easier batch file access to the personality settings.
A target device’s virtual disk name and mode can be retrieved using GetPersonality.exe. The following reserve values are included in the [StringData] section of the Personality.ini file:
$DiskName=<xx> $WriteCacheType=<0 (Private image) All other values are standard image; 1 (Server Disk), 2 (Server Disk Encrypted), 3 (RAM), 4 (Hard Disk), 5 (Hard Disk Encrypted), 6 (RAM Disk), or 7 (Difference Disk). Min=0, Max=7, Default=0> <!--NeedCopy-->
The xx is the name of the disk. A virtual disk name cannot start with a $. This symbol is used for reserved values such as $DiskName and $WriteCacheType. The following message displays if a name that starts with $ is entered:
A name cannot start with a $. This is used for reserve values like $DiskName and $WriteCacheType. The $DiskName and $WriteCacheType values can be retrieved on the target device using GetPersonality.exe. <!--NeedCopy-->
$WriteCacheType parameter includes the following options for RAM Cache with overflow to local hard disk mode:
- private = 0
- serverCache = 1
- deviceRamCache = 3
- deviceDiskCache = 4
- deviceRamDisk = 6
- serverPersistent = 7
- deviceRamCacheWithDiskOverflow = 9 *
The command line utility GetPersonality.exe allows users to access the Target Device Personality settings from a Windows batch file. The program queries the INI file for the user and places the personality strings in the locations chosen by the user. GetPersonality.exe supports the following command line options:
``` pre codeblock GetPersonality FieldName /r=RegistryKeyPath <- Place field in registry GetPersonality FieldName /f=FileName <- Place field in file GetPersonality FieldName /o <- Output field to STDOUT GetPersonality /? or /help <- Display help
## Examples Setting a Registry Key Value: The example below retrieves the Target Device Personality data value from the DefaultPrinter field and writes it to the target device registry to set the default printer for the device. The Target Device Personality String Set in Target Device Properties is:
DefaultPrinter= \CHESBAY01\SAVIN 9935DPE/2035DPE PCL 5e,winspool,Ne03:
A batch file run on the target device would include the following line:
GetPersonality DefaultPrinter /r=HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Device
Note: The actual key name should be the UNC name of the network printer, such as \\\\dc1\\Main, and the value that should be entered for the key would be similar to winspool,Ne01: where Ne01 is a unique number for each installed printer. ## Setting Environment Variables Setting environment variables with personality data is a two-step process: 1. Use the GetPersonality command with the /f option to insert the variable into a temporary file. 1. Use the set command to set the variable. For example, to set the environment variable Path statement for the target device a personality name, define the Pathname with the string value: ``` %SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft Office\OFFICE11\;C:\Program Files\Microsoft SQL Server\80\Tolls\Binn <!--NeedCopy-->
The /f option creates a temporary file, allowing for a name to be assigned, in this case temp.txt. The following lines would then need to be included in the batch file: ``` GetPersonality Pathname /f=temp.txt set /p Path= <temp.txt <!--NeedCopy--> ``` Note: If the filename specified with the /f option already exists, GetPersonality will not append the line to the file. Instead, the existing line is overwritten in the file.