I can't think of a way to EASILY do that without post-processing the input 
array:

                $in = gc file.txt
                $ary = @()
                for ($i = 0; $i -lt $in.Length; $i += 2)
                {
                                $ary += $in[$i]
                }

But that isn't very efficient. I'd just process every other line of the input 
array.

Regards,

Michael B. Smith
Consultant and Exchange MVP
http://TheEssentialExchange.com

From: mck1012 [mailto:[email protected]]
Sent: Sunday, May 09, 2010 10:48 PM
To: NT System Admin Issues
Subject: Powershell Question

I am trying to read in a text file and putting the odd lines in a array. The 
text file is a list of names like the example below. So my array would have 
ServerOne,ServerThree,ServerFive in it.


ServerOne
ServerTwo
ServerThree
ServerFour
ServerFive
ServerSix


Thanks for the help





~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to