Results 1 to 4 of 4

Thread: Is it possible to return the results of a poweshell command from an rsp page?

  1. #1

    Is it possible to return the results of a poweshell command from an rsp page?


    I recently had a request to serve up results of a powershell command from an rsp page.
    I wasn't sure it its possible, so I thought I would ask if anyone had tried.

    First request is just a simple list of all services on a given server.

    PowerShell.exe  Get-Service -ComputerName myserver


  2. #2
    Lianja MVP
    Join Date
    Feb 2012
    Berea, KY, USA
    Hi Herb,

    on way is to instantiate the PowerShell object as a .Net object -- check out Doug Hennigs article on using PowerShell in VFP, p.33: don't know if wwDotNetBridge, which it uses, will work in Lianja, but there's a good chance it will. If it does, this would give you the opportunity to make a dynamic application with a list of the scripts or cmdlets or whatever.

    The alternative is to run with the run command in Lianja (in a VFP code section of the .rsp) and generate a log file output and use that to display or parse/display.


  3. #3
    Hi Hank,

    My thought was something along the lines of

    Run "PowerShell.exe Get-Service | Export-Csv c:\psoutput\test.csv"
    - which works in the desktop.

    But I recall Barry telling us to create tempfile for rsp pages.

    Like in the image example:
    // Look up an employee
    seek "Smith"

    // Create a unique temporary name (guaranteed uniqueness across concurrent users in a network)
    m_tmpnam = tmpnam()

    // Extract the photo from the database and write it to the temporary file

    // Generate the base64 encoded contents as an IMG tag and output into the HTML5
    base64_encode_file(m_tmpnam, objectType(photo), "100px", "100px")

    // Don't forget to remove the temporary file
    erase &m_tmpnam

    So - I'm thinking if I want to use an RSP page, I probably need to output the file to m_tmpnam.
    But I will play around with it.



  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    UK, USA, Thailand
    Blog Entries
    Hi Herb,

    Yes because multiple requests can be running concurrently.
    Principal developer of Lianja, Recital and other products

    Follow me on:




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Journey into the Cloud
Join us