Hey jpb801,
One trick I often do when scripting in Altiris/GSS is to set a local version of the token or variable. It's going to sound weird, or even like it doesn't make any sense... but my work around for dealing with the issue you are describing to set a local variable toward the begining of the script. It usually does the trick and only adds one additional line of code. I have provided an example below...
set TEMP_TASKSERVER=%TASKSERVER%
Then later where you would normally reference %TASKSERVER%, instead reference %TEMP_TASKSERVER% and you should not have any more issues with the value not resolving correctly.
I know this may sound silly and pointless but give it a try and let me know. Thanks!
If this solves your issue, kindly mark this as a solution. Thanks :)