Invoking PowerShell with PHP?

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Mark Walker Mark Walker 2 months, 2 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #46439
    Profile photo of Mark Walker
    Mark Walker
    Participant

    Forgive my newbness, but is there a way to invoke powershell scripts with or any other web enabled language? I'm working on creating a network monitoring tool with a web interface, and I would like it to be able to refresh data via button click on the web interface, which would hopefully run a PS script in the background and return the updated data to to the SQL database, where it could then be retrieved by the web interface and displayed.

    Alternatively, is there an existing tool that someone else has built and made available for me to learn from, adapt and utilize?

    #46447
    Profile photo of Arie H
    Arie H
    Participant
    #46570
    Profile photo of Paal Braathen
    Paal Braathen
    Participant

    Just make sure you sanitize user input. That first example is scary.

    It's mentioned in a comment, but this is a must:

    // Best practice tip: We run out POST data through a custom regex function to clean any unwanted characters, e.g.:
    // $username = cleanData($_POST["username"]);
    #47069
    Profile photo of Mark Walker
    Mark Walker
    Participant

    Awesome, thank you very much!

    • This reply was modified 2 months, 2 weeks ago by Profile photo of Mark Walker Mark Walker.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.