Displaying Original input from CSV in results Table

Hi All

i have a csv, content like below

mark.prior@contoso.com
James.dean@contoso.com

now when i pipe this to get-mailboxstatistics as below i get the expected result,

{Pre} get-content “c:\temp\email2.csv” | Get-MailboxStatistics | Select DisplayName, database, LastLog* | Out-GridView
{/pre}

DisplayName Database etc… etc…


Mark Prior blah
James Dean blaa_1

however i would like the original csv input posted alongside the generated result

DisplayName Database etc… etc… Orignal Input


Mark Prior blah mark.prior@contoso.com
James Dean blaa_1 James.dean@contoso.com

thanks much guys

p.s like the new forum

get-content "c:\temp\email2.csv" | Get-MailboxStatistics | Select DisplayName, database, LastLog* | Out-GridView

dang cant edit original to correct code

$csv = import-csv "c:\temp\email2.csv"

foreach($user in $csv){

$mbxstats = Get-MailboxStatistics $user

[pscustomobject]@{

prop1 = $user.column1
prop2 = $user.column1
prop3 = $mbxstats.property1
prop4 = $mbxstats.property2
#etc..
}

}

great thanks, ended up using get-content as import-csv was erroring
end script

$csv = get-content "c:\temp\email1.csv"
foreach($user in $csv){

$mbxstats = Get-MailboxStatistics $user

[pscustomobject]@{

'Email Address' = $user
'Database Location' = $mbxstats.DatabaseName
'Last Accessed By' = $mbxstats.LastLoggedOnUserAccount
'Last Logon Time' = $mbxstats.LastLogonTime
} 

}

how would i output this to gridview ?

either assign variable before the foreach or pipe after the last bracket

$csv = get-content "c:\temp\email1.csv"
$output = foreach($user in $csv){

$mbxstats = Get-MailboxStatistics $user

[pscustomobject]@{

'Email Address' = $user
'Database Location' = $mbxstats.DatabaseName
'Last Accessed By' = $mbxstats.LastLoggedOnUserAccount
'Last Logon Time' = $mbxstats.LastLogonTime
} 

}

$output | out-gridview

$csv = get-content "c:\temp\email1.csv"
foreach($user in $csv){

$mbxstats = Get-MailboxStatistics $user

[pscustomobject]@{

'Email Address' = $user
'Database Location' = $mbxstats.DatabaseName
'Last Accessed By' = $mbxstats.LastLoggedOnUserAccount
'Last Logon Time' = $mbxstats.LastLogonTime
} 

} | out-gridview

thanks dan thats great