Video Screencast Help

The Power of Custom Tokens

Created: 20 Jun 2008 • Updated: 20 Jun 2008 • 8 comments
CondorMan's picture
+2 2 Votes
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 8 CommentsJump to latest comment

brentlund's picture

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.

-1
Login to vote
Thomas Baird's picture

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
Technical Solutions Architect @ XCEND Group
www.xcendgroup.com

+1
Login to vote
Alexey-Art's picture

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?

+3
Login to vote
Thomas Baird's picture

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
Technical Solutions Architect @ XCEND Group
www.xcendgroup.com

+5
Login to vote
Jason Gallas's picture

In DS 6.9 there was a nice %JOBNAME% token.  I use this token when imaging computers.  How would I write something equivalent in DS 7.1?  I am looking for the specific table that I would need to query as well as the format.

+2
Login to vote
Pascal KOTTE's picture

Hi, any answer for Jason nice question ? we are interested also :)

~Pascal @ Kotte.net~ Do you speak French? Et utilisez Altiris: venez nous rejoindre sur le GUASF

+5
Login to vote
epkpej's picture

Hello, any solution for Jason's question, we are also interested in the %JOBNAME% token?

+1
Login to vote
Nicolas Horchower's picture

Hello, still no news for the %JOBNAME% in 7.1+ ? Thanks

--
NH

0
Login to vote