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 vDisk file system for easy access by your custom scripts or applications.
The file is formatted as follows:
FieldName1=Field data for first field
FieldName2=Field data for second field
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 vDisk name and mode can be retrieved using GetPersonality.exe. The following reserve values are included in the [StringData] section of the Personality.ini file:
$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>
The xx is the name of the disk. A vDisk 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.
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:
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
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:
- Use the GetPersonality command with the /f option to insert the variable into a temporary file.
- 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
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
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.