execute cmd from pstool with several parameters

0

In my work I have to enter multiple hosts and execute wmic commands to get information from each computer using PSEXEC from pstool.

An example of the command that I have to enter to connect is the following:

psexec \HOST cmd.exe

This is executed and opens the cmd of the entered host. To speed things up I wanted to make a .bat to execute these wmic commands, but whenever I execute the command psexec is waiting for something to enter it by keyboard and I do not want it to wait for that, but to indicate it in some way like parameter.

What I have in my .bat is the following:

for /f %%a in (hostAlcanzables.txt) do (
  echo HOST: %%a
  cd pstool
  psexec \%%a cmd.exe
  wmic bios get manufacturer
  wmic bios get serialnumber
  wmic cpu get name
  wmic memphysical get maxCapacity
  wmic logicaldisk get size
pause
)

I have in a file all the hosts that can be connected at this moment, I go through each one with a for , I connect to the cmd of the host in that position. But I want you to run those wmic commands, however when you run psexec the cmd window opens and you wait.

How can I solve it? Thanks

    
asked by HunterCode 12.10.2018 в 19:13
source

0 answers