Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Powershell multi-valued columns rather than rows.

Posted on 2013-12-03
3
Medium Priority
?
289 Views
Last Modified: 2013-12-03
I have this command which works great but instead of adding this in one row I would rather for it to have its own column and line up accordingly.

get-recipient -resultsize:unlimited | where {$_.emailaddresses -match "someuser@contoso.local"} | select name,@{Name="emailaddresses";Expression={$_.emailaddresses}} |
0
Comment
Question by:techdrive
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 39692751
Try this code and see if it works for you..
Get-recipient -resultsize:unlimited | 
 where {$_.emailaddresses -match "someuser@contoso.local"} | % {
  $name = $_.Name
  $_.emailaddresses | Select @{N="Name";E={$name}},@{N="emailaddresses";E={$_}}
}

Open in new window

0
 

Author Comment

by:techdrive
ID: 39692808
Perfect I JUST CHANGED -MATCH TO -like and it works. Thanks a million man wish I had your brains when it comes to powershell.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39692819
I don’t think it’s a rocket science.. you can learn it.. :-)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
A brief introduction to what I consider to be the best editor for PowerShell.
Loops Section Overview
Screencast - Getting to Know the Pipeline

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question