Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda