Author Posts

September 30, 2016 at 7:22 pm

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.

September 30, 2016 at 8:14 pm

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.

October 4, 2016 at 6:17 pm

Hi, could you please provide an example?

October 5, 2016 at 7:21 am

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

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

October 5, 2016 at 2:53 pm

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

October 9, 2016 at 6:47 pm

Cool. Thank you