Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

The Power of Custom Tokens

Updated: 20 Jun 2008 | 4 comments
CondorMan's picture
+1 1 Vote
Login to vote

A useful feature that allows you to use any data in your Deployment Server database in a script task is Custom Tokens. The syntax for a custom token is %#*"Your SQL Query Here"%. Here are some custom tokens that might come in handy.

%#*"SELECT GETDATE()"%

will return the current date and time.

%#*"SELECT @@servername"%

will return the name of the SQL Server.

%#*"SELECT g.name FROM computer c, computer_group g WHERE c.group_id = g.group_id AND c.computer_id = %ID%"%

will return the name of the group that this computer is a member of.

Comments

brentlund's picture
06
May
2009
0 Votes 0
Login to vote

can a SQL query UPDATE the DB?

I'd like to run a script that updates the token, or should it be a SQL query that updates the DB......basically i have a script that prompts the person running the job for data. I'd like the data to be avaiable in the NEXT script that runs....

I'm not sure fo the best way to do this.

Thomas Baird's picture
04
Nov
2010
0 Votes 0
Login to vote

Why are there 2 scripts?

Is there a particular reason to have two scripts if they feed off one-another?

If there was, then My guess is that you'd be best to actually use SQL to write to the DB in a known location, maybe based on WS GUID or something, and then make your next script query the DB based on the same key.  It'd be easier to combine the scripts, or possibly to use a return code, but there's a thought.  Writing to the DB might be interesting though...

Thomas Baird
Endpoint Management Specialist 

Remember to give a thumbs-up to any post that is helpful.
It notifies readers of the forum that there's useful information in that thread.

Alexey-Art's picture
25
Nov
2010
0 Votes 0
Login to vote

Hi All, I've tried to run

Hi All,

I've tried to run Script task (command script or vbscript type ) with the custom token

%#*"SELECT GETDATE()"% on SMP 7.1 and got empty result. Does the SMP 7.1 support the custom token?

Thomas Baird's picture
25
Nov
2010
0 Votes 0
Login to vote

That's a custom token?

OH OH OH.

The DB and nominclature is COMPLETELY DIFFERENT than in DS 6.x.  No, you can't use that methodology.

And I'm really confused on why we're posting on this thread.

But in DS 7.1, you have to first create the custom token in the NS Console (remember, this KB was written prior to the existence of Ds 7.1) and then you have to insert it into your script from there.  Yes, you can use custom tokens, and yes, you can do fun things with them, but no, this sintax will not work.

Thomas Baird
Endpoint Management Specialist 

Remember to give a thumbs-up to any post that is helpful.
It notifies readers of the forum that there's useful information in that thread.