Sign in to follow this  
Followers 0
lonnieother

AutoIt + PSexec to determine information of a computerlist

4 posts in this topic

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.

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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?

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0