8 Replies Latest reply: Jul 12, 2012 12:43 AM by Shilpa Gokhale RSS

Reading file contents from a remote server

Fernando NameToUpdate

HI everybody, I need to read the contents of a file from a remote server. I'm trying to use Autopilot-AD-Utilities/Terminal/File/Read however, I don't see a place where to indicate the server ip and credentials. THere is a way of adding those fields or I need to use a different one?


Thank you,

  • 1. Reading file contents from a remote server
    Anirban Dutta

    Moved discussion the AO Community

  • 2. Reading file contents from a remote server
    Richard de Vries

    Methods on how to accomplish this depend on your implementation of AO. If AO is running on Windows and the remote file you are trying to read is on a Windows System as well (or on a System accessible via CIFS) you could pass the filename as \\remote-server\directory\filename.txt. This assumes of course that your AO servers have access to the file.


    If your AO instance is running on Linux and/or your file is located on linux or simply not accessible via CIFS, you will need to become a bit creative and retrieve the contents of the file some other way. For instance, getting the contents by using the SSH/Telnet workflows to do a "cat" on the file, or perhaps retrieve it via SCP/SFTP/FTP prior to reading it.

  • 3. Reading file contents from a remote server
    Fernando NameToUpdate

    Richard, thank you very much for taking the time to answer mi thread.

    Both AO and the external servers are windows environment.

    In this situation AO doesn't have credentials to access the external server. I need to provide a set of credentials to it. Meaning that the solution \\remote-server is not possible. However, what I have used before is Autopilot-ad-Utilities\Terminal\Windows Command. In there there is a possiblity to run a command in an external server providing hostname or ip, credentials. I've been using that normally the thing is that command is creating a file I need to read as well. I need to take advantage of the fact the connections is already established and get the file contents from it. I folund out that is only possible to use with one command only at a time. For instance if I execute a commnad and in the next line I added another command; this one is added as a parameter to the command in the first line.

    Is there a way I can add another line inside Utilities\Terminal\Windows Commnad to execute another one?

    Or pehaps Using Terminal\File\Read I can accomplish that in a way?

    I don't know I'm lost and I know that worst case scenario will happen. For me would be another process running the same command in the external server and overwriting the output file created from the first one. That is the reason I'm avoiding to run two separate connections one to run the command and another to read the output file.


    Thank you again Richard.

  • 4. Reading file contents from a remote server
    Richard de Vries

    Hmmm. Have you considered running multiple commands in a one-line command?


    You mentioned you use the Windows Command adapter to execute a command that creates the file. Within this same connection, you now also want to READ that, correct?


    Let's say the command you are running is called "generatefile.exe", perhaps you can try:


    generatefile.exe && type <generated file.txt>


    In windows, && seperates commands. See http://support.microsoft.com/kb/279253

  • 5. Reading file contents from a remote server
    Ranganath Samudrala

    One other option is to create a batch file with multiple commands in it, copy the batch over and invoke that batch file using Windows Command adapter. Create a batch file using File adapter and then copying+invocation can be done using Windows Command adapter.



  • 6. Reading file contents from a remote server
    Fernando NameToUpdate


    Thank you I was missing that point & is the way to go unless BMC has a more elegant way. I'd implemented and it works.


    Thank you!

  • 7. Reading file contents from a remote server
    Fernando NameToUpdate


    Thank you but I tried that before I posted this and I was receiving errors.

  • 8. Reading file contents from a remote server
    Shilpa Gokhale


    Glad that your query was resolved by using multiple commands in a one-line command option. You can also see https://docs.bmc.com/docs/display/public/baob201203/Adapter+request+and+response+for+the+Windows+Command+adapter for details about using the Windows Command adapter for passing multiple commands (in a batch file) as a single command in the adapter request. Hope that helps. Thanks.