Using Custom Token Variables to Write DS Scripts

For those of you who are Deployment Server administrators, you will feel my pain, trying to write deployment server scripts without hardcoding the path of a server in the scripts. Why is this a problem, I only have 1 DS? If anyone has more than 1 DS you have probably done an export of a job folder and imported it into another DS for use. Heck Altiris has a DSImport utility on the Notification Server to do this for you if you have Deployment Solution installed, but that is a whole other topic. The idea here is to be able to write script jobs without having to hard code a UNC path in the script so that it can be used on other DS’s without changing the path on import. How to accomplish this became a daunting task until I read the Altiris Document on custom tokens in DS6.8. By creating a custom table on each Deployment Server’s eXpress database, I could hard code the path for each DS within that table. Then I could use the custom token in my scripts and write them all with the same token path so I could use them on each deployment server without having to change the UNC path everytime I had to do a job folder import. You can learn more about DS Scripting here . At our location, we use a robocopy job to replicate software between multiple sites for our DS ADmins to access when provisioning computers. This allows us to write the scripts so that they are non-unique and can easily import a folder of jobs from one DS to another without having to change a bunch of scripts.

I have a few DS servers called ServerA, ServerB, and ServerC.

Each DS has it’s own eXpress database with a custom table created called ‘ds_server’ with a column name called ‘filestor’ with a varchar50 setting.

ServerA has a sharename called \\SiteA\myshare, ServerB has a share name called \\SiteB\myshare, etc….

On each DS I have added the share name to the tables so that ServerA’s eXpress database table called ds_server has a location added in the filestor column with \\SiteA\myshare as the location, ServerB’s eXpress database table has a setting of \\SiteB\myshare, etc… You get the picture.

Now when writing my jobs, instead of doing something like:

REM Install Adobe Reader from software share
%windir%\system32\msiexec.exe /i \\SiteA\myshare\adobereader\reader.msi /qb

I can use the option of using my custom token and make my script importable into each DS without having to change the path to the MSI package:

REM Install Adobe Reader from some file server
%windir%\system32\msiexec.exe /i %#!DS_Server@FileStore%\adobereader\reader.msi /qb

The idea here is that I have a replicated software repository\file share on each site that I manage with my Deployment Servers, and I reference the location to the actual fileshare by passing the token variable in the script and it is translated to the actual UNC path to the file server at that site.

%d bloggers like this: