Script to obtain hardware and OS information

I’ve just been tasked to obtain the version of Solaris and the type of Sun workstation the user is using.  I know the uname –a command can give me the info I need.  What I don’t want to do is have to telnet to over 400 machines.  Is there a way, I can write a script which rsh’s to each machine by it’s IP address (, and write the output of each machine’s uname –a to a text file?  


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You will have to set up the .rhosts file on each machine to do that ( or .ssh/authorized_keys if you use ssh).  So if you haven't already  done that, logging into each machine and running the uname command will be as quick.  If however you want to do it , so you can do it again later.
After you have set up your .rhosts file

while ( $x < 255)
rsh uname -a 5.212.144.$x >> /tmp/vers.txt
x=expr ($x + 1)

I'm not in front of a unix box at the moment, so my syntax may be a bit dodgy, try it and post the errors

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bpb25Author Commented:
Ran the script, here's the error I got.

syntax error at line 7: 'x=expr' unexpected

Luckily the majority of the machines already have a .rhosts in place.

x=`expr ($x+1)`
back single quotes, for a command substitution
To make the math a bit easier, use Korn shell. Also the rsh line looks a bit odd. And only one subnet was tried. Try:

while ( $x < 255)
rsh 5.212.144.$x iuname -a >> /tmp/vers.txt
rsh 5.212.145.$x iuname -a >> /tmp/vers.txt
((x = x + 1))

You must have remote authentication database set
So create a file /.rhosts(assuming you  will remotely login as root)
enter your system name
create a script  and execute the script

for i in 144 145
while($x < 255)
rsh 5.212.$i.$x uname -a >> /tmp/info.txt
x=`expr $x + 1`

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.