# Running .exe on multiple machines

**URL:** <https://forums.powershell.org/t/running-exe-on-multiple-machines/7291>\
**Category:** PowerShell Help\
**Created:** [September 30, 2016, 2:40pm UTC](https://forums.powershell.org/t/running-exe-on-multiple-machines/7291 "2016-09-30T14:40:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayblanck](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@jayblanck](https://forums.powershell.org/u/jayblanck)\
**Post date:** [September 30, 2016, 2:40pm UTC](https://forums.powershell.org/t/running-exe-on-multiple-machines/7291/1 "2016-09-30T14:40:23Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![matt-bloomfield](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-bloomfield](https://forums.powershell.org/u/matt-bloomfield)\
**Post date:** [October 1, 2016, 6:41am UTC](https://forums.powershell.org/t/running-exe-on-multiple-machines/7291/2 "2016-10-01T06:41:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:40pm UTC](https://forums.powershell.org/t/running-exe-on-multiple-machines/7291/3 "2024-05-16T20:40:16Z")

</div>

Closed on May 16, 2024, 8:40pm UTC


