Running .exe on multiple machines

Welcome Forums General PowerShell Q&A Running .exe on multiple machines

This topic contains 1 reply, has 2 voices, and was last updated by

2 years, 5 months ago.

  • Author
  • #54774

    Points: 0
    Rank: Member

    Hey All,

    New to PS and looking for a script to remotely run a .exe on multiple machines. The first part is to get the list of computers and the second to run the .exe on each. Do I need to use the foreach command possibly? I don't get an error when I run it, but I'm not getting a log file that the .exe should create once it runs.

    $computers = Get-Content "C:\temp\servers.txt"
    Invoke-Command -ComputerName $computers -filePath C:\temp\file.exe
  • #54787

    Points: 41
    Rank: Member

    The FilePath parameter is used to specify a PowerShell script. I'm surprised you're not getting an error to that effect.

    This should work:

    Invoke-Command $computers {c:\temp\file.exe}

    As you're running the command on a remote computer, c:\temp\file.exe must exist on that machine.

The topic ‘Running .exe on multiple machines’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort