Jump to content

AutoIt + PSexec to determine information of a computerlist


Recommended Posts

Hello all,

I have written a GUI to automate an install script that my team uses. We use PSexec in order to run MSIexec on a list of copmuters

Psexec @computerlist.txt -u "Username" -p "Password" Msiexec /i "MyProgram.msi" /qn

This works great because we can just gather the list of computers on the network in a list and then it installs them all for us. The problem comes because we have different installers for 64bit and 32bit computers.

In the .Bat file we have, we used this command to determine what the processor type was. (This was through a loop in the batch script to \\%i is the same thing as @computerlist.txt

Psexec \\%i -u "Username" -p "Password" cmd /c set | find "PROCESSOR_ARCHITECTURE"

this was able to return amd64 or x86.

Now i'm getting to the problem i'm running into with AutoIt. I cannot use WMIC on this, because that requires some services to be on that may or may not be running on the local machine. So i'm stuck with set. When i use PSexec with Autoit, I am having trouble retrieving the output of the child process so that I can do something with it. All I can do is helplessly watch it write to the screen and then disappear.

Any help would be greatly appreciated. The current command that I am running is

RunWait(@compsec & " /C " & 'Psexec @computerlist.txt -u "Username" -p "Password" cmd /c set | find "PROCESSOR_ARCHITECTURE" >> Processor.txt'

Also, changing >> to 2> does not pull the information.

If anyone knows an easier way to do that, i'm totally fine with that too.

Link to comment
Share on other sites

You could try to catch the result reading Stdout and/or Stderr. For an example please check "StdoutRead" in the help file.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Ah, should have mentioned that. I cannot get this with Stderr. I suspect it is becuase the output that psexec generates is actually a child process that is returned from the remote computer and printed to the screen.

Can you think of an easier way to determine if remote computers are 64 or 32 bit?

Link to comment
Share on other sites

Don't know if this helps.

On my Windows 7 system I get "Systemtype: x64-based PC" if I run "systeminfo /fo list"

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...