Jump to content
Anders Bermann

Variable in Download File?

Recommended Posts

Hi all,

 

Is it possible in Automate, in a script, to include a variable in the Download File ?

I know it's possible to do in the Destination - but is this possible in the Source? 

My problem is, that I have 3 ISO files, which filename is dependend on the language setting on the target OS. I have found a way to extract the base language information in PowerShell and through that build an ISO file name, which reflects the various language setting. However I cannot set this up in the Download File in the script in Automate. 

Does anyone have any idea of this, or is this simply not possible?

Share this post


Link to post
Share on other sites

It definitely is, I use this all the time.

I've got an LoB app that updates regularly. The executable is named LoB-version.exe, so at the beginning of my script, I have a Set Variable Constant named Version, and the download step is something like Transfer\LoB\LoB-@VERSION@.exe, and I just reference that version the whole way down so I've only got to change the variable.

I haven't figured this part out --- so if anyone else sees this post hopefully you can chime in. It seems like I can only get this to work on the download step if I copy the file to the transfer folder BEFORE creating the script step to download it. If I copy the files later, or rename or move them, the download script step just fails, unless I create a new download step. I can't figure that part out.

Share this post


Link to post
Share on other sites

Thanks for this. But I cannot unfortunately get it to work... :(

 

The log is here:

The Script(6571) failed in the Then section at step 36. The reason: ERR Download File Failed

Script: S6571 - Starting at Server Time: Friday, May 29, 2020 4:39:02 PM
IF F1  T: 1.4181753
L1 F17 Script (P1): 6563   Delay (P2):  T: 1.4181753
Start S6563 
IF F1  T: 1.4211694
L3 F135 Command (P1): '(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name Release...' T: 1.4211694
L4 F20 SetType(P1):1   Parameter(P2):2004   VariableName(P3):WindowsVersion T: 3.4263059
L5 F80 EdfId (P1): 966   TargetId (P2): 2023   Value (P3): 2004 T: 3.4263059
L6 F29 Message (P1): Windows version is: 2004 T: 3.4273154
End S6563 
L2 F20 SetType(P1):1   Parameter(P2):10   VariableName(P3):requiredSpaceGBWindows T: 3.4283085
L3 F17 Script (P1): 6566   Delay (P2):  T: 3.4283085
Start S6566 
IF F1  T: 3.4313083
L1 F235  T: 3.4313083
L2 F29 Message (P1): Newest Win 10 build is: 2004
  T: 7.4397355
End S6566 
L4 F17 Script (P1): 6477   Delay (P2):  T: 7.441677
Start S6477 
IF F1  T: 7.4436777
L2 F235  T: 7.444678
L3 F29 Message (P1): OS language is: da-DK
  T: 11.4558989
End S6477 
L5 F70 Value (P1): @OSTargetVersion@   Comparer (P2): 3   To (P3):    Jump (P4): :OSTargetVersionOK T: 11.4578963
L8 F139 Note (P1): :OSTargetVersionOK T: 11.4578963
L9 F29 Message (P1): OS target version set to: @OSTargetVersion@ T: 11.4578963
L10 F70 Value (P1): WindowsVersion   Comparer (P2): 7   To (P3): @OSTargetVersion@   Jump (P4): :NoUpgradeNeeded T: 11.4589048
L11 F29 Message (P1): Restarting LabTech service... T: 11.4589048
L12 F235  T: 11.4598955
L13 F115 User (P1):  T: 15.4651002
L14 F115 User (P1):  T: 15.4660986
L15 F139 Note (P1): :BelowTargetVersion T: 15.4660986
L16 F53  T: 15.4660986
L17 F29 Message (P1): Checking if there is enough free space to run the upgrade. T: 33.471692
L18 F20 SetType(P1):1   Parameter(P2):'SELECT CONCAT(drives.letter,':...'   VariableName(P3):sqlToRun T: 33.473675
L19 F117 Sql (P1): 'SELECT ROUND(free/1024) FROM `drives`, computers WHERE drives.computerid = computers.compu...' T: 33.473675
L22 F139 Note (P1): :ContinueInstall T: 33.4746694
L23 F114 File (P1): 'C:\WindowsSetupFolder\setup\se...'   Check (P2): 0   Jump (P3): :BeginInstall T: 33.4746694
L24 F114 File (P1): 'C:\WindowsSetupFolder\Windows1...'   Check (P2): 0   Jump (P3): :upgrade_continue T: 35.4766877
L25 F29 Message (P1): Creating folders T: 37.4805116
L26 F154 Folder (P1): C:\WindowsSetupFolder T: 37.4814735
L27 F29 Message (P1): da-DK
  T: 39.483734
L28 F17 Script (P1): 6567   Delay (P2):  T: 39.4847343
Start S6567 
IF F1  T: 39.487728
L1 F235  T: 39.4887265
L2 F29 Message (P1): Path is: Win10_2004_da-DK_x64.iso
  T: 43.5018379
End S6567 
L29 F29 Message (P1): Filename: Win10_2004_da-DK_x64.iso
  T: 43.5038292
L35 F29 Message (P1): Downloading da-DK
  ISO T: 43.5038292
L36 F28 Local (P1): Windows10\ISO\Win10_2004_da-DK_x64.iso
    Destination (P2): C:\WindowsSetupFolder\Windows10.iso T: 43.5048289

What's interesting is, that the L36 Source and Destination is (or seems to be) correct... 

image.thumb.png.48728423f04ca7dd5786b790fd2b1cad.png

The File Download dialog is looking like this...  Is there any issues with this approach?

Share this post


Link to post
Share on other sites
5 hours ago, JosephM said:

I can only get this to work on the download step if I copy the file to the transfer folder BEFORE creating the script step to download it. If I copy the files later, or rename or move them, the download script step just fails, unless I create a new download step.

Interesting, I don't think I've noticed that.  However usually either I'm changing the variable, or for Win10 FUs I copy the script and change the variable.  The File Download function is supposed to be a dropdown listing the files on the server, but is editable.  Perhaps if the step is set to a file that doesn't exist (yet) it gets confused?

3 hours ago, Anders Bermann said:

ERR Download File Failed

Could it be anything else besides a bad filename, like something interrupting the connection on a large download?  Does it not start or does it start and error out later?

Share this post


Link to post
Share on other sites

I use it like this
image.thumb.png.bdba036ad315f7d482a8f2f18d4faa44.png

I needed to remove trailing linefeed and carriage return otherwise line 5 wouldn't work.
image.thumb.png.91bf0f568b13474555058318914d4a61.pngThen it's just downloading the file:

 

Share this post


Link to post
Share on other sites
On 5/30/2020 at 12:53 AM, Wupsje said:

I use it like this
image.thumb.png.bdba036ad315f7d482a8f2f18d4faa44.png

I needed to remove trailing linefeed and carriage return otherwise line 5 wouldn't work.
image.thumb.png.91bf0f568b13474555058318914d4a61.pngThen it's just downloading the file:

 

Thanks for this one.

How do you remove the trailing line feed and line break/return? I think that's what my problem is...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...