# using psexec

**URL:** <https://forums.powershell.org/t/using-psexec/7289>\
**Category:** PowerShell Help\
**Created:** [September 30, 2016, 1:52pm UTC](https://forums.powershell.org/t/using-psexec/7289 "2016-09-30T13:52:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tony-rodal](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@tony-rodal](https://forums.powershell.org/u/tony-rodal)\
**Post date:** [September 30, 2016, 1:52pm UTC](https://forums.powershell.org/t/using-psexec/7289/1 "2016-09-30T13:52:37Z")

</div>

Hi, unfortunately at the company I work at PSremoting is disable so I cant use it. From a list of computers how could I check to see if a executable is on a computer and then run it remotely via psexec? I also have to take into account we have a mixture of 32 bit OS and 64 bit OS computers. So depending on the OS type the executable will be located either in the C:\Program Files or C:\Program Files (x86) folders. Thanks for any help in advance.

---

<div class="post-metadata">

**Author:** ![daniel-krebs](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/daniel-krebs/32/484_2.png) [@daniel-krebs](https://forums.powershell.org/u/daniel-krebs)\
**Post date:** [September 30, 2016, 2:44pm UTC](https://forums.powershell.org/t/using-psexec/7289/2 "2016-09-30T14:44:58Z")

</div>

Sorry I’m on my phone at the moment but you should Google for CIM\_DataFile to find the executable without PS Remoting.

I hope that helps.

---

<div class="post-metadata">

**Author:** ![tony-rodal](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@tony-rodal](https://forums.powershell.org/u/tony-rodal)\
**Post date:** [October 4, 2016, 12:47pm UTC](https://forums.powershell.org/t/using-psexec/7289/3 "2016-10-04T12:47:11Z")

</div>

Hi, could you please provide an example?

---

<div class="post-metadata">

**Author:** ![max-kozlov](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@max-kozlov](https://forums.powershell.org/u/max-kozlov)\
**Post date:** [October 5, 2016, 1:51am UTC](https://forums.powershell.org/t/using-psexec/7289/4 "2016-10-05T01:51:43Z")

</div>

Get-WMIObject -Query “Select \* From CIM\_Datafile Where Name = ‘D:\test.txt’”

Get-WMIObject -Query “Select \* From CIM\_Directory Where Name = ‘D:\data’”

---

<div class="post-metadata">

**Author:** ![wilfredo-perez](https://avatars.discourse-cdn.com/v4/letter/w/e99b99/32.png) [@wilfredo-perez](https://forums.powershell.org/u/wilfredo-perez)\
**Post date:** [October 5, 2016, 9:23am UTC](https://forums.powershell.org/t/using-psexec/7289/5 "2016-10-05T09:23:36Z")

</div>

Her is something that I came up with, to give you an idea:

```
$strcomputers = Get-Content C:\file.txt
foreach ($cn in $strcomputers){
    $OSArch = Get-WmiObject -Class win32_OperatingSystem -ComputerName $cn | select pscomputername, OSArchitecture
       if( $OSArch.OSArchitecture -eq "64-bit")
            {Write-Output "Hello, I am using 64-bit"} 
        else
            {Write-Output "Hello, I am using 32-bit"}
}
```

I would ping the computers first. You will have to come up with that code. The code will have to change

---

<div class="post-metadata">

**Author:** ![tony-rodal](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@tony-rodal](https://forums.powershell.org/u/tony-rodal)\
**Post date:** [October 9, 2016, 1:17pm UTC](https://forums.powershell.org/t/using-psexec/7289/6 "2016-10-09T13:17:04Z")

</div>

Cool. Thank you

---

<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/using-psexec/7289/7 "2024-05-16T20:40:12Z")

</div>


