Run an exe on remote pc RRS feed

  • Question

  • Hello,

    Newbie in Powershell , I have try with start-job, invoke-command, ... but no way. I just want to  run my exe on each computer

    $ComputerName = ("\\M13086","\\M13136")

    $exe ="C:\techno\Outils\Alerte\Alerte.exe" 

    Parametres for Alerte.exe

    $param1 = "C:\techno\Outils\AlerteI\FichierAlerte\TexteAlerte.txt" 
    $param2 = "C:\techno\Outils\Alerte"
    $param3 = "https://hdm-utils.unit.stat/TexteAlerte.txt"

    How to run my Alerte.exe in the For Each ??

    Thanks a lot. I've been searching since 4 days

    ForEach ($Computer in $ComputerName) 



    Tuesday, December 12, 2017 4:48 PM

All replies

  • Good Day

    What i did to run a single exe file in different machines i created a task sequence in SCCM
    The first step was to install the client in this case the Veritas DLO Agent
    And the second step was to invoke the client since the command provided by Veritas didnt worked

    Powershell.exe -ExecutionPolicy ByPass -Command "Invoke-Item 'C:\Program Files (x86)\Veritas\Veritas DLO\DLO\DLOClientu.exe'"

    Created a collection and made a deployment, the client was launched without errors
    Hope this example can help you to achieve your goal

    BOTTOMLINE: USE Invoke-Item instead of Start-Job or Invoke-Command


    Alvaro Saenz

    Tuesday, December 12, 2017 5:05 PM
  • You could use psexec with a text file of PC's
    Tuesday, December 12, 2017 11:15 PM
  • You can try

    $credentials  = Get-Credential
    $ComputerName = ("\\M13086","\\M13136")
    $ComputerName | foreach {
        Invoke-Command -ComputerName $_ -Credential $credentials -ScriptBlock { & "C:\techno\Outils\Alerte\Alerte.exe"}

    Tuesday, May 15, 2018 12:31 PM