Powershell script to import size of mailbox in CSV file using Add-Member NoteProperty
$date = get-date -format d
$date = $date.ToString().Replace(“/”, “-”)
$output = ".\" + "mailboxdata" + $date + "_.csv"
$z = @()
$g = @("guptaa10","rawata")
foreach ($f in $g)
{
$b = Get-Mailbox -Identity $f
$c = Get-MailboxStatistics $f
$object = New-Object -TypeName PSObject
$object | Add-Member NoteProperty –Name User –Value $b.Alias
$object | Add-Member NoteProperty –Name Quota –Value $b.ProhibitSendQuota
$object | Add-Member NoteProperty –Name Size –Value $c.TotalItemSize
$z += $object
}
$z | Export-Csv $output
No comments:
Post a Comment