using psexec

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.

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.

Hi, could you please provide an example?

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

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

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

Cool. Thank you