timgreen7077
asked on
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.
ASKER
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,pro hibitsendq uota,prohi bitsendrec eivequota | 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.
$userlist = import-csv .\limit.csv
foreach ($user in $userlist){
get-mailbox -Identity $user.email | select name,issuewarningquota,pro
}
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.
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
}
ASKER
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.
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.
Ohhhhhhh. Powershell 2.0, eh?
Try this:
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
ASKER
This is the error I now get:
+= : Method invocation failed because [System.Management.Automat ion.PSObje ct] doesn't contain a method named 'op_Addition'.
At line:2 char:12
+ $results += <<<< get-mailbox -Identity $user.email | select name,issuewarningquota,pro hibitsendq uota,prohi bitsendrec eivequota
+ CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
+= : Method invocation failed because [System.Management.Automat
At line:2 char:12
+ $results += <<<< get-mailbox -Identity $user.email | select name,issuewarningquota,pro
+ CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Powershell 2.0 (!@$#%!@#@#$)
I have nothing to test with but I think this should work:
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
ASKER
Nope same error. I will update WMF and get a more current verison of PS and give it a try.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect and thanks.
Open in new window