using psexec

This topic contains 5 replies, has 4 voices, and was last updated by Profile photo of Tony Rodal Tony Rodal 2 weeks, 1 day ago.

  • Author
  • #54770
    Profile photo of Tony Rodal
    Tony Rodal

    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
    Profile photo of Daniel Krebs
    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
    Profile photo of Tony Rodal
    Tony Rodal

    Hi, could you please provide an example?

  • #54956
    Profile photo of Max Kozlov
    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
    Profile photo of Wilfredo Perez
    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
    Profile photo of Tony Rodal
    Tony Rodal

    Cool. Thank you

You must be logged in to reply to this topic.