Deployment Solution

 View Only
  • 1.  ReplaceTokens does not work when "Run the script from file" option is used

    Posted Mar 31, 2009 02:18 PM
    I have DS 6.9 SP1. I am trying to replace tokens in s sysprep.inf file using PXE DOS automation environment.
    I was scratching my head as to why this simple script does not work from a batch file:

    ===================Tokenize.bat :
    REM ReplaceTokens .\sysprep\sysprep.inf .\temp\%ID%.txt
    =============

    In the Express share\Temp folder I see a batch file named "5000003.bat" appearing. This batch file is the same as my batch file and the token %ID% is properly replaced with 5000003.txt:

    ===============5000003.bat :
    REM ReplaceTokens .\sysprep\sysprep.inf .\temp\5000003.txt
    ================

    However, in the temp folder I expected to see the file 5000003.txt which never appeared. So, for some reason the ReplaceTokens command does not create the destination file...

    So, I have decided to use the second option: "Run this script" and pasted the same contents of my batch file in the text field there. Supprisingly, after running the script, the destination sysprep file with replaved tokens appeared. So, it worked.

    Is this by design, a bug or I am missing something?


  • 2.  RE: ReplaceTokens does not work when "Run the script from file" option is used

    Posted Oct 18, 2010 08:16 AM

    Hi,

    I have the same question.

    After trying to have my scripts in files (so I can re-use them in different jobs without be worried about to change things in many different locations) and having some errors, I've debugged to this ...

    The ReplaceTokens command doesn't work if the script is run from file. Why?

    Is it possible to solve this problem?

    How can I replace tokens in my file if this doesn't work as expected?

    Thank you.



  • 3.  RE: ReplaceTokens does not work when "Run the script from file" option is used

    Posted Oct 19, 2010 04:05 AM

    .. is only working from an embedded script, by design.

    What you can do is create a "Tokenize" task in your job that is only doing this and in you script you use the end-result

    Tokenize Task:
    IF EXIST .\temp\%ID%.inf DEL /Q .\temp\%ID%.inf
    REM ReplaceTokens .\sysprep\sysprep.inf .\temp\%ID%.inf

    pmakaveev: I myself would not go from an inf to a txt file...  Keep the same extension just for the sake of clearaty

    !! For this task you can actually use: Script Run Location: Locally on the Deployment Server" so it will not tickle your client-computer !!

     

    Script-file:
    IF EXIST .\temp\%ID%.txt (
       What ever you whant to do with it...
    )

    This way you can both use tokenization and re-use your script-files.
    As far as I know, the only way

    Good Luck!



  • 4.  RE: ReplaceTokens does not work when "Run the script from file" option is used

    Posted Oct 19, 2010 01:09 PM

    Hi there,

    I'm not sure whether this is still an issue for you or not, but what I had to do in some cases was changing the command line to something like this (keeping the primary example here):

    REM ReplaceTokens .\sysprep\sysprep.inf ./temp/%ID%.txt
     

    Note the forward slashes in the output part. I never figured why sometimes it only works with the forward slashes, but that did the trick for me.

    -BBC