Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
In JavaScript, Take 2 values and add them & run it on a Powershell script

I'm struggling to find the answer to this. I need to take two values, one is an input type "Printer Name" and the other is a dropdown value "DCdropdown", and I need to take those values given and assign them to certain parts of powershell script and then run the script. I know the script that I need to write, but I don't know how to take the values and add it to the script and then run it when I hit the "Make it so" button. This is what I have so far:

<p>Which printer would you like to add?</p>

<input type="text" placeholder="Printer Name" id="myInput">
           
    <script>
        function getInputValue(){
            // Selecting the input element and get its value 
            var inputVal = document.getElementById("myInput").value;
            
            // Displaying the value
            alert(inputVal);
        }
    </script>

<p>Which Distribution Center are you located?</p>

<select id="DCdropdown" onchange="leaveChange(this)">
<option value=""></option>
<option value="xxx">CMB</option>
<option value="xxx">DS</option>
<option value="xxx">FNO</option>
<option value="xxx">GNWD</option>
<option value="xxx">JAX</option>
<option value="xxx">RMVL</option>
</select>


 <button type="button" onclick="getInputValue();">Make it so</button>
 <script>
  function myFunction(){
  document.getElementByID
}
 </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This is impossible without additional infrastructure, and this is by design.

Web browsers cannot run PowerShell code. You would at a minimum need to be running a web application which can execute PowerShell code on its end. This could be listening on the local machine, or it could be remote. But it's not happening with only the browser alone, and it's not happening with raw JavaScript.

If this is part of a webapp being served then this is possible but still would have to be done by executing something on the webserver itself, can't be done from the browser on the local machine. In any event suggesting a solution in this space exceeds the scope of this question.

In theory a custom browser plugin (not extensions) could facilitate this this but AFAIK all major browsers either no longer support plugins or disable them by default, and you have to ensure such a plugin is installed.

Edit: I forgot about a newer technology called Blazor that lets dotnet run under WebAssembly (and in theory PowerShell), but it would not be useful here as it is sandboxed to the browser just as Javascript and other site code is.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!