Import to CSV from Exchange 2010

I imported a list of users from a CSV file into a variable in EMS so that I can adjust mailbox quota warnings prohitsend and prohibitsendreceive. This worked fine, but I can't see to export the results of these changes to another csv file. Can anyone point me in the right direction.
LVL 17
timgreen7077Exchange EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Amit KumarCommented:
use below one:

Get-mailbox -ResultSize unlimited | select Name,PrimarySMTPAddress,issuewarningquota,ProhibitSendquota,ProhibitSendReceiveQuota | Export-csv c:\data.csv

Open in new window

0
timgreen7077Exchange EngineerAuthor Commented:
How can I do this just for users in a csv file. When I try the below only 1 user is outputted:

$userlist = import-csv .\limit.csv
foreach ($user in $userlist){
get-mailbox -Identity $user.email | select name,issuewarningquota,prohibitsendquota,prohibitsendreceivequota | Export-Csv .\viewer.csv
}

and the example you gave will search all mailboxes when I only need to get the info for users in the limit csv and then output to new csv named what ever.
0
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Add -append to your Export-CSV cmdlet.

$userlist = import-csv .\limit.csv
foreach ($user in $userlist){
get-mailbox -Identity $user.email | select name,issuewarningquota,prohibitsendquota,prohibitsendreceivequota | Export-Csv .\viewer.csv -append
}

Open in new window

0
What were the top attacks of Q1 2018?

The Threat Lab team analyzes data from WatchGuard’s Firebox Feed, internal and partner threat intelligence, and a research honeynet, to provide insightful analysis about the top threats on the Internet. Check out our Q1 2018 report for smart, practical security advice today!

timgreen7077Exchange EngineerAuthor Commented:
This is the error i got when -append was added:
Export-Csv : A parameter cannot be found that matches parameter name 'append'.

I'm using exchange management shell but powershell 2.0

any other suggestions by chance.
0
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Ohhhhhhh. Powershell 2.0, eh?

Try this:
$userlist = import-csv .\limit.csv
foreach ($user in $userlist){
$results += get-mailbox -Identity $user.email | select name,issuewarningquota,prohibitsendquota,prohibitsendreceivequota
}
$results | Export-Csv .\viewer.csv

Open in new window

0
timgreen7077Exchange EngineerAuthor Commented:
This is the error I now get:

+= : Method invocation failed because [System.Management.Automation.PSObject] doesn't contain a method named 'op_Addition'.
At line:2 char:12
+ $results += <<<<  get-mailbox -Identity $user.email | select name,issuewarningquota,prohibitsendquota,prohibitsendreceivequota
    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
0
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Powershell 2.0 (!@$#%!@#@#$)

I have nothing to test with but I think this should work:

$userlist = import-csv .\limit.csv
foreach ($user in $userlist){
    $lo = get-mailbox -Identity $user.email | select name,issuewarningquota,prohibitsendquota,prohibitsendreceivequota
    $results = $results + $lo
 }
$results | Export-Csv .\viewer.csv

Open in new window

0
timgreen7077Exchange EngineerAuthor Commented:
Nope same error. I will update WMF and get a more current verison of PS and give it a try.
0
Amit KumarCommented:
Try this one, it will for sure work in PS 2.0

$userlist = import-csv .\limit.csv 
$results = foreach($user in $userlist) {get-mailbox -Identity $user.email | select name,issuewarningquota,prohibitsendquota,prohibitsendreceivequota} 
$results | Export-Csv .\viewer.csv

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
timgreen7077Exchange EngineerAuthor Commented:
Perfect and thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.