Jump to content
Steve Goldner

Access Denied during File Download

Recommended Posts

I am having issues with a File Download operation in a script.  I've pulled out the 4 lines that copy the file for testing purposes. 

LabTech server shell execute cmd.exe /c dir / b "%lltshare%\Transfer\Software\ESET\FileSecurity" | find "File_Security_Installer"
SET:  @FileName@ = %shellresult%
Create Folder as Admin: C:\Windows\LTSvc\packages\eset\FileSecurity
DOWNLOAD:  /Labtech/Transfer/Software/ESET/FileSecurity/@FileName@  saved to  C:\Windows\LTSvc\packages\eset\filesecurity\@FileName@
 

All works, except for the last line.  Below is the script output:

IF F1  T: 1.3674454
L2 F181 Command (P1): cmd.exe T: 1.3674454
L3 F20 SetType(P1):1   Parameter(P2):'AiO_File_Security_Installer.ex...'   VariableName(P3):FileName T: 2.0798917
L4 F155 Folder (P1): C:\Windows\LTSvc\packages\eset\FileSecurity T: 2.0798917
L5 F28 Local (P1): Software\ESET\FileSecurity\AiO_File_Security_Installer.exe
   Destination (P2): 'C:\Windows\LTSvc\packages\eset\filesecurity\AiO_File_Securit...' T: 167.3284872
L6 F29 Message (P1): 'ERR Access Denied writing to Local File C:\Windows\LTSvc\packages\eset\filesecurity\AiO_Fi...' T: 185.380119

The script finds the file named 'AiO_File_Security_Installer.exe' and sets the variable @fileName@ successfully, but the actual file download operation fails with Access Denied.  The interesting part is that if I change the last line of the script to a non-variable file name then the file download works fine.  Example:

from:
DOWNLOAD:  /Labtech/Transfer/Software/ESET/FileSecurity/@FileName@  saved to  C:\Windows\LTSvc\packages\eset\filesecurity\@FileName@
-to-
DOWNLOAD:  /Labtech/Transfer/Software/ESET/FileSecurity/@FileName@  saved to  C:\Windows\LTSvc\packages\eset\filesecurity\MyFileName.exe
 

The Deployments & Defaults tab has an Administrator account entered.  Any guidance would be helpful.

Thanks - Steve

Share this post


Link to post
Share on other sites

You need to make super sure that the variable does not have a linefeed character in it. (Common outcome when setting to %shellresult%).

Using a Script String Regex function to set the variable to amatch for the regex (no quotes) "[^\r\n]*" will give you one line of text with no linefeed as the result.

  • Thanks 2

Share this post


Link to post
Share on other sites
16 hours ago, DarrenWhite99 said:

You need to make super sure that the variable does not have a linefeed character in it. (Common outcome when setting to %shellresult%).

Using a Script String Regex function to set the variable to amatch for the regex (no quotes) "[^\r\n]*" will give you one line of text with no linefeed as the result.

Is this setup correctly?

image.png.e0c138ab7fb630bb7f3142f04aafd9e1.png

Share this post


Link to post
Share on other sites
17 hours ago, DarrenWhite99 said:

You need to make super sure that the variable does not have a linefeed character in it. (Common outcome when setting to %shellresult%).

Using a Script String Regex function to set the variable to amatch for the regex (no quotes) "[^\r\n]*" will give you one line of text with no linefeed as the result.

Thank you DarrenWhite99.  That solved the issue.  Below are the changes that I made to get it working per your suggestion.

 

 

Annotation 2019-02-12 114222.jpg

Annotation 2019-02-12 114351.jpg

  • Thanks 1

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...