How to get object from previous pipeline?

1..5 |%{"test" |select @{n="name";e={$_}}}

How to get 1 to 5 to $_  (current value in pipeline) instead of "test"  ?

I was bored, playing around.. and wanted to list all items from array based on this example
0..5 |%{get-aduser username |select @{n="oupath";e={($_.distinguishedname -split ",*..=")[$_]}}} 

June 19th, 2015 7:01am

1..5 |%{$num = $_;"test" |select @{n="name";e={$_}}, @{n="num";e={$num}}}
  • Marked as answer by Mekac 20 hours 2 minutes ago
Free Windows Admin Tool Kit Click here and download it now
June 19th, 2015 7:08am

1..5 |%{$num = $_;"test" |select @{n="name";e={$_}}, @{n="num";e={$num}}}
  • Marked as answer by Mekac Friday, June 19, 2015 11:07 AM
June 19th, 2015 11:04am

1..5 |%{$num = $_;"test" |select @{n="name";e={$_}}, @{n="num";e={$num}}}
  • Marked as answer by Mekac Friday, June 19, 2015 11:07 AM
Free Windows Admin Tool Kit Click here and download it now
June 19th, 2015 11:04am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics