Usuário com melhor resposta
Get mailboxstatistics from a CSV file

Pergunta
-
Hey guys,
In my organization we have close to 3000 mailboxes. I got the task to find the total size of specific 1000 mailboxes.
I have the CSV file that has:
FirstName, LastName, Alias (email address).
I want to run get-mailboxstatstics from the CSV file and pipe total size of my 1000 mailboxes to another CSV file.
Let's assume my CSV file is: users.csv
What would be the PowerShell script to execute this?
- Editado Morris - MS quinta-feira, 17 de janeiro de 2013 14:35
quinta-feira, 17 de janeiro de 2013 14:34
Respostas
-
$report = @() $outfile = "MailboxSizeReport" + ".csv" $user = Import-CSV c:\users.csv foreach ($id in $user) { Get-MailboxStatistics $id.alias | Sort-Object TotalItemSize -Descending $tmp = New-Object PSObject $tmp | Add-Member -type NoteProperty -name DisplayName -value $id.DisplayName $tmp | Add-Member -type NoteProperty -name TotalItemSize -value $id.TotalItemSize $report += $tmp } $report | Export-CSV c:\$outfile –notypeinformation -encoding "unicode"
Om
- Marcado como Resposta Morris - MS quinta-feira, 17 de janeiro de 2013 19:15
quinta-feira, 17 de janeiro de 2013 16:34 -
Looks like I got the following script working for me:
$Users = Import-Csv c:\ExportList_new.csvforeach ($id in $users)
{
Get-MailboxStatistics $id.alias | Sort-Object TotalItemSize –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}}
}
- Marcado como Resposta Morris - MS quinta-feira, 17 de janeiro de 2013 19:15
quinta-feira, 17 de janeiro de 2013 17:21
Todas as Respostas
-
$report = @() $outfile = "MailboxSizeReport" + ".csv" $user = Import-CSV c:\users.csv foreach ($id in $user) { Get-MailboxStatistics $id.alias | Sort-Object TotalItemSize -Descending $tmp = New-Object PSObject $tmp | Add-Member -type NoteProperty -name DisplayName -value $id.DisplayName $tmp | Add-Member -type NoteProperty -name TotalItemSize -value $id.TotalItemSize $report += $tmp } $report | Export-CSV c:\$outfile –notypeinformation -encoding "unicode"
Om
- Marcado como Resposta Morris - MS quinta-feira, 17 de janeiro de 2013 19:15
quinta-feira, 17 de janeiro de 2013 16:34 -
Hello Prakash,
Thank you for offering me the solution script.
I want to make things simpler, I don't need the entire list (1000 mailboxes size) output.
All that I need is the totalitemsize (total size of 1000 mailboxes).
Can it be done?
Morris
quinta-feira, 17 de janeiro de 2013 16:47 -
$user = Import-CSV c:\users.csv $total = 0 foreach ($id in $user) { $tmp = Get-MailboxStatistics $id.alias $item = $tmp.TotalItemSize $itemsize=[int]$item
$size = 0
$size = $total + $itemsize $total = $size } write-host "Total size:" $total
This one will give you the total itemm size of all the 1000 mailboxes.
Om
- Editado Om Prakash Nath quinta-feira, 17 de janeiro de 2013 17:31
quinta-feira, 17 de janeiro de 2013 17:15 -
Looks like I got the following script working for me:
$Users = Import-Csv c:\ExportList_new.csvforeach ($id in $users)
{
Get-MailboxStatistics $id.alias | Sort-Object TotalItemSize –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}}
}
- Marcado como Resposta Morris - MS quinta-feira, 17 de janeiro de 2013 19:15
quinta-feira, 17 de janeiro de 2013 17:21 -
-
Prakash,
I actually started: start-transcript results.txt
Ran the script
Stop-transcript
That did the trick.
quinta-feira, 17 de janeiro de 2013 19:15 -
Hi,
I am specfiying only the email address it were not working ?
i have specicy FirstName, LastName, email address as mentioned in the thread.
If could help me it would be grea
THnka
Muthu
Thanks Muthu
domingo, 2 de agosto de 2020 11:33