locked
Get-Mailbox RRS feed

  • Question

  • Hi experts

    i want to pull the report of all my user in the below format, experts please help me on this 


    Sunday, July 29, 2018 11:26 AM

Answers

  • Hi Risingflight,

    Try the following script:

    Foreach($users in Get-Mailbox -ResultSize Unlimited){$users | Foreach-Object {    
    $user = $_   
    $stats = Get-MailboxStatistics $user.Name
    $archiveStats = Get-MailboxStatistics $User.name -Archive        
    New-Object -TypeName PSObject -Property @{        
    DisplayName = $User.DisplayName
    IssueWarningQuota = $User.IssueWarningQuota        
    ProhibitSendQuota = $User.ProhibitSendQuota        
    ProhibitSendReceiveQuota = $User.ProhibitSendReceiveQuota
    MailboxUsage = $stats.TotalItemSize
    ArchiveQuota = $User.ArchiveQuota
    ArchiveWarningQuota = $User.ArchiveWarningQuota
    ArciveUsage = $archiveStats.TotalItemSize
    RetentionPolicy = $User.RetentionPolicy                  

    } |Export-CSV C:\MailboxStats.csv -NoTypeInformation -Append 
    }

    Note: please keep the script as a .PS1 file,  and run it.

    I have tested in my lab, the result as below:


    Best Regards,
    Niko Cheng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


    • Edited by Niko.Cheng Monday, July 30, 2018 3:24 AM
    • Proposed as answer by Egor Vasilev Monday, July 30, 2018 5:25 AM
    • Marked as answer by Risingflight Monday, July 30, 2018 6:37 PM
    Monday, July 30, 2018 3:21 AM

All replies

  • Hi Risingflight,

    Try the following script:

    Foreach($users in Get-Mailbox -ResultSize Unlimited){$users | Foreach-Object {    
    $user = $_   
    $stats = Get-MailboxStatistics $user.Name
    $archiveStats = Get-MailboxStatistics $User.name -Archive        
    New-Object -TypeName PSObject -Property @{        
    DisplayName = $User.DisplayName
    IssueWarningQuota = $User.IssueWarningQuota        
    ProhibitSendQuota = $User.ProhibitSendQuota        
    ProhibitSendReceiveQuota = $User.ProhibitSendReceiveQuota
    MailboxUsage = $stats.TotalItemSize
    ArchiveQuota = $User.ArchiveQuota
    ArchiveWarningQuota = $User.ArchiveWarningQuota
    ArciveUsage = $archiveStats.TotalItemSize
    RetentionPolicy = $User.RetentionPolicy                  

    } |Export-CSV C:\MailboxStats.csv -NoTypeInformation -Append 
    }

    Note: please keep the script as a .PS1 file,  and run it.

    I have tested in my lab, the result as below:


    Best Regards,
    Niko Cheng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


    • Edited by Niko.Cheng Monday, July 30, 2018 3:24 AM
    • Proposed as answer by Egor Vasilev Monday, July 30, 2018 5:25 AM
    • Marked as answer by Risingflight Monday, July 30, 2018 6:37 PM
    Monday, July 30, 2018 3:21 AM
  • Hi niko i will check and let u know
    Monday, July 30, 2018 5:21 AM
  • Hi Niko Thanks alot
    Monday, July 30, 2018 6:37 PM