We help IT Professionals succeed at work.

Adding items to ArrayList prints ArrayList index to the screen

YZlat
YZlat asked
on
Medium Priority
774 Views
Last Modified: 2012-05-11
When I add items to ArrayList, Powershell also outputs the ArrayList index to the screen. How do i prevent that from happening?

Here is my code:
 
$alComputers=new-object Collections.ArrayList
foreach ($child in $ou.psbase.Children) { 
    	if ($child.ObjectCategory -like '*computer*') { 
		$alComputers.Add($child)
	} 
}

Open in new window

Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT

Author

Commented:
Thanks a bunch!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.