Deployment Solution

 View Only
  • 1.  Copy file using token in source path

    Posted Dec 27, 2017 01:13 PM
      |   view attached

    I am trying to use the Copy File task and the Access from UNC location option to copy a file from the task server the client is connetected to. When I statically include the server name in the path, such as "\\ps-102\MAIN\...", it works fine. When I use a token for the server name in the path, such as "\\%TASKSERVER%\MAIN\...", it doesn't. I've tried it with no quotes and with single or double quotes around the token but I always get the message Enter valid UNC source location. When I run a command script task with @echo %TASKSERVER%, it returns the server name as expected with no problems so I know the token has the proper value in it. Do I have the syntax wrong in the Copy File task? If this isn't possible, what options do I have? When I tried to script the file copy, I got an access denied to the source using the default system account. I'd prefer to use the Copy File task if this is possible before looking into that problem. Any help would be appreciated. Thanks.



  • 2.  RE: Copy file using token in source path

    Posted Jan 03, 2018 10:06 PM

    Hi jpb801,

    I had some issues with command line scripting when using % for wildcard purposes. I had to type it 2 times in order for that to work. Don't know if this will help you.

    In regards to the access denied issue, make sure the UNC path has been shared with the account that you're trying to run the script under. Try declaring your credentials.

    From my experience, you're better off using xcopy or robocopy.



  • 3.  RE: Copy file using token in source path

    Posted Jan 08, 2018 12:01 AM

    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 :)