Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Perl $ENV hash

by kingjamesid (Acolyte)
on Apr 20, 2010 at 13:48 UTC ( #835772=perlquestion: print w/replies, xml ) Need Help??
kingjamesid has asked for the wisdom of the Perl Monks concerning the following question:


I understand how to pull out (a particular) ENV variable/value pairs from my machine, but i need to get the same pair from a list of machines. For e.g. I have a system var "T_VERSION" in all machines I support. about 100 of them. i am trying to pull out the values of this var from all 100 machines and export to a txt file.

I am not sure, how to get to other's ENV hash and get it. Any idea?

Replies are listed 'Best First'.
Re: Perl $ENV hash
by Corion (Pope) on Apr 20, 2010 at 13:56 UTC

    It's quite simple. On Windows, if you have Domain Administrator privileges, you can use WMI to query each machine. Otherwise, you'll have to log into each machine and query the environment information there.

      I have domain admin privileges. how can I makes sure, i have WMIC libraries installed. Is this defauly?
      I ran perldoc WIN32::WMI but it said no docs found. so I am assuming lib not loaded.
      can you help me get started on where to look for the lib or if its already installed.
Re: Perl $ENV hash
by Anonymous Monk on Apr 20, 2010 at 13:52 UTC
    log into said machine (ssh, whatever), set up env (load profile, whatever), call printenv and send the results back to your machine
Re: Perl $ENV hash
by roboticus (Chancellor) on Apr 20, 2010 at 17:03 UTC


    Please note that the environment isn't machine-specific--rather it's account-specific. So you could have any number of T_VERSION values for a machine.


Re: Perl $ENV hash
by choroba (Bishop) on Apr 20, 2010 at 13:52 UTC
    What method do you use to connect to the machines?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://835772]
Approved by moritz
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2018-04-25 11:47 GMT
Find Nodes?
    Voting Booth?