Parameter that collects remaining objects for Where-Object - by Blindrood

Status : 


Sign in
to vote
ID 808514 Comments
Status Active Workarounds
Type Suggestion Repros 0
Opened 11/14/2013 12:45:06 AM
Access Restriction Public


Let's say I have an array of 30 elements, 10 of them has property Enable set to true and 20 to false.
Now, if I want to have two separate arrays, one for objects with this value and second without, I have to make 2 Where-Object operations.
$array= $list of objects
$firstarray = $array | Where-Object Enable
$secondarray = $array | Where-Object Enable -eq $false
My idea is to make it into one operation
$array = #list of objects
$firstarray = $array | Where-Object Enable -RemainingObjects $secondarray

This could create two arrays at once from one array based on one filter
Sign in to post a comment.