psexec with array

  • Thread starter Christopher Graves
  • Start date
C

Christopher Graves

I'm trying to run commands on a remote machine via psexec. The issue
that I'm having is when grabbing the IP address from the array it wants
to put everything that follows on a separate line.

uName = "admin"
pWord = "1234"
ip = IO.readlines("ipAddresses.txt")

ip.each do |host|
puts "psexec \\\\#{host} -u #{uName} -p #{pWord} cmd"
end

the reply is

psexec \\127.0.0.1
-u admin -p 1234 cmd

is there a way to get that output on the same line so that psexec can
run properly with the system process.

thanks
 
C

Christopher Graves

I did some more testing and I found the issue. It is with how the file
is being placed in the ip array.

How would you import each line of the ipAddress.txt file into a
different object in the array?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,137
Messages
2,570,797
Members
47,342
Latest member
eixataze

Latest Threads

Top