Custom Tokens for Deployment Solution and Ghost Solution Suite
search cancel

Custom Tokens for Deployment Solution and Ghost Solution Suite

book

Article ID: 196088

calendar_today

Updated On:

Products

Deployment Solution Ghost Solution Suite

Issue/Introduction

Custom Tokens


Custom tokens can be defined and used to extract data from any Microsoft SQL Server database table.

This is most commonly used, for example, to extract data from a custom SQL table (within a database) that you have created for the purpose of storing additional computer inventory information.

Environment

DS 8.x
GSS 3.x

Resolution

Token Syntax


All tokens must be enclosed in percent signs "%" and use one of the following two syntax options:

%#Alias^!table name@column name%

OR

%#Alias*"SQL query statement"%

Example 1:
%#FS2!computer@computer_name%

Example 2:

%#FS2*"Select computer_name from computer where computer_id=5000023"%

The following table explains each part of a custom token:

Token Item

Description

%

The percent symbol identifies the opening and closing of the token.

#

The hash symbol identifies this as a custom token instead of a system token. This must be used for all custom tokens.

Alias

(optional) - Specifies the alias you created from a Deployment Server (or GSS) console (Tools > Options > Custom Data Sources.) When used, this will provide the information and credentials to gain access to an external
SQL database. If the alias option is not used, the values will be obtained from the same Deployment Server (or GSS) database the Job containing this token is using.

^

This symbol indicates that this is a global identifier token.
By default, all values used by the custom token will be obtained from the entry in the database that matches the computer ID of the computer the Job using the
token is assigned to.
This global identifier tells Deployment Solution (or GSS) not to use the value matching the computer ID. Instead, it will
use the first value found in the specified table and column.

!

This symbol indicates that the text following this symbol is the name of the table to query. This field is required for all custom tokens.

@

This symbol indicates that the text following this symbol is the name of the column where the value should be obtained. This field is required for all custom tokens.

*

This symbol indicates that the text following this symbol is a SQL statement.
For example:
Using this instead of the table name@column name option allows you to collect values for a computer with

a different computer ID number than the one the Job (using this token) has. Any valid SQL statement can be used.



Finding the Right Token Value

Be default, all values for the custom tokens will be located using the computer ID number that is automatically assigned to all computers when they are added to the Deployment Server (or GSS) database. This ID number is located in the computer_ID column of its associated table.

TIP: The computer ID number can be viewed from a Deployment Server (GSS) console by right-clicking a computer and selecting Properties > General.

After this computer ID number has been located, the associated column value can be used.

Example


To give you a better idea of how this works, consider a Deployment Server (or GSS)

Job using the following Run Script Task:




echo off
echo This computer has %#FS2!hardware@Ram_Free MB of free RAM
pause


FS2 is the alias name.

hardware is the table name

Ram_Free is the column name to find the value in.

 

The following table exists in the SQL database being accessed using the alias name of FS2:

Column Name ->

Computer_ID

Computer_name

Ram_Free

Row Values ->

500001

PC-1

213

 

500002

PC-2

256

 

500003

PC-3

256

 

500004

PC-4

64

 

If a Job using the above script were assigned to the PC-1 computer (with the computer_id of 500001), the following would be displayed on the client's computer screen, with the values being found in a database that is accessed using the alias name of FS2:

C:\
This computer has 213 MB of free RAM
Press any key to continue…


If a Job using the above script were assigned to the PC-4 computer (with the computer_id of 500004), the following would be displayed on the client's computer screen:

C:\

This computer has 64 MB of free RAM
Press any key to continue…


More Examples


To return the names of the computers from the local database you could use:


%#! computer@computer_name%


To return the names of the computers from the external database with an alias name of serv2, you could use:

%#serv2!computer@computer_name%

To return the name of a different computer than the one the Job is assigned to using a SQL statement, you could use:

%#*"SELECT computer_name from computer
where computer_id=50000237%


To return the name of a different computer than the one the Job is assigned to using a SQL statement and an external database using the alias of serv2, you could use:

%#serv2*"SELECT computer_name from computer
where
computer_id=5000023"%