using psexec

This topic contains 5 replies, has 4 voices, and was last updated by  Tony 1 year, 9 months ago.

  • Author
  • #54770


    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.

  • #54775

    Daniel Krebs

    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.

  • #54941


    Hi, could you please provide an example?

  • #54956

    Max Kozlov

    Get-WMIObject -Query "Select * From CIM_Datafile Where Name = 'D:\\test.txt'"

    Get-WMIObject -Query "Select * From CIM_Directory Where Name = 'D:\\data'"

  • #54975

    Wilfredo Perez

    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"} 
                {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

  • #55125


    Cool. Thank you

You must be logged in to reply to this topic.