Harvest

 View Only
  • 1.  User agent on Windows runs bat files as

    Posted Dec 20, 2021 07:48 AM
    Hi,

    When I execute a shell script on UNIX or Linux, and perform a "whoami" command, the result is the user I used to connect to the agent to, regardless of whether I user "-usr {user} -pw {password}" or "-er {dfofile.dfo}".

    However, when I execute a .bat file on a Windows agent, and perform a "set" command, the "USERNAME" environment variable is not the user I connected to the agent with. Instead, the user is the machine name with a "$" appended at the end 9eg. if my computer name was computername, the USERNAME variable from the "set" command will be computername$. This happens regardless of whether I use "-usr {user} -pw {password}" or "-er {dfofile.dfo}".

    My problem is that I'm getting an Access Violation from a Delphi program (similar to a Java NullpointerException" but only when I run my script through the agent. When I run it from the command line outside of Harvest, it works fine. I suspect the user used to run the batch file might have something to to with it.

    Any suggestions would be appreciated.

    Kind regards,
    Jarus

    ------------------------------
    Jarus Bosman
    Senior Software Developer
    State Information Technology Agency
    South Africa
    ------------------------------


  • 2.  RE: User agent on Windows runs bat files as

    Broadcom Employee
    Posted Dec 20, 2021 10:35 AM
    HI Jarus,

    Which version of Harvest Agent are you experiencing this on?
    Please us know the following to be able to assist you better.

    1. What is the Operating system on which your agent is running? 
    2. What is the bitness of your Harvest agent (32-bit or 64-bit) ?

    Regards,
    Mallik.


  • 3.  RE: User agent on Windows runs bat files as

    Posted Dec 21, 2021 04:48 AM
    Hi Mallik,

    We are running v13.0.3 of the agent

    1. OS is Windows Server 2012 R2
    2. Agent is 64-bit

    Kind regards,
    Jarus 

    PS. Please note I will be on leave until 11 January 2022!

    ------------------------------
    Jarus Bosman
    Senior Software Developer
    State Information Technology Agency
    South Africa
    ------------------------------



  • 4.  RE: User agent on Windows runs bat files as

    Posted Dec 21, 2021 02:03 PM

    As a service the windows agent can only be started as SYSTEM. Any shells created off that service is going to be very different than shells create from an RDP session. For example network resources will be limited. An HCO command for example will decompress files as SYSTEM into a temp directory prior to placing it in the client path. 

    Was Delphi installed for all users? With the same account or different? Does your account have power user or admin rights? Try to see if the you can `type` the LICENSE (or some other ASCII) file in the Delphi home directory from within your BAT file. Is Delphi 64bit?




  • 5.  RE: User agent on Windows runs bat files as

    Broadcom Employee
    Posted Dec 22, 2021 05:16 AM
    Hi Jarus,

    You may need a patch to be applied for this one.
    Please raise a support ticket to have a better track of things.

    ~Mallik.


  • 6.  RE: User agent on Windows runs bat files as

    Posted Jan 17, 2022 06:26 AM
    Thank you Mallik, I will request our rep to raise a ticket!

    ------------------------------
    Jarus Bosman
    Senior Software Developer
    State Information Technology Agency
    South Africa
    ------------------------------



  • 7.  RE: User agent on Windows runs bat files as

    Posted Jan 17, 2022 06:25 AM
    Hi Jeff,

    My apologies for the VERY late reply.

    I'm not running Delphi via the agent. It's an application (exe) written in Delphi and compiled for 64 bit, that I execute via the agent. It is not installed, just copied to a folder from where I execute it.

    Kind regards

    ------------------------------
    Jarus Bosman
    Senior Software Developer
    State Information Technology Agency
    South Africa
    ------------------------------



  • 8.  RE: User agent on Windows runs bat files as

    Posted Jan 17, 2022 06:30 AM
    Update: The Delphi application is still 32 bit - Could this be a problem on a 64-bit agent? It runs fine if executed locally on a 64-bit machine, even from Harvest (using a local UDP).

    ------------------------------
    Jarus Bosman
    Senior Software Developer
    State Information Technology Agency
    South Africa
    ------------------------------



  • 9.  RE: User agent on Windows runs bat files as

    Posted Dec 23, 2021 07:42 PM

    The shells created off the windows service for the agent are very different from the login shells that you get when connecting to the host. The windows agent for harvest can only be started with the SYSTEM account. So everything starts with that account and a little dance then happens after that. With HCO commands for example the files are uncompressed with SYSTEM in a temp directory before they are placed into the client path. SYSTEM can also have issues using network resources when headless.  

    You're going to need some diagnostics to crack this one. I'd start by checking permissions on the Delphi files. Was Delphi installed for all users on the box? Maybe have the agent use the "type" command to display the LICENESE file (or some other ascii file) in the Delphi directory. Is your user a power user or admin on the box? Was it the same user that installed Delphi?