tastydoosh

Untitled

Aug 18th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function Get-MailboxUsage {
  2.  
  3.     $mailboxuser = Read-Host "Please enter the mailbox to check or leave blank for all mailboxes"
  4.     $getprohibitsendquota = Read-Host "Would you like to include max mailbox capacity? (Y/N)"
  5.  
  6.     if ($getprohibitsendquota -eq "Yes") {
  7.  
  8.             $SO_Params = @{
  9.             Property = 'DisplayName, IsArchiveMailbox, ItemCount, TotalItemSize, ProhibitSendQuota'}}
  10.  
  11.     else {
  12.  
  13.             $SO_Params = @{
  14.             Property = 'DisplayName, IsArchiveMailbox, ItemCount, TotalItemSize'}}
  15.  
  16.     if ($mailboxuser -eq '') {
  17.             Get-Mailbox |
  18.             Get-MailboxStatistics |
  19.             Select-Object @SO_params |
  20.             Format-Table –autosize}
  21.     else {
  22.             Get-Mailbox $mailboxuser |
  23.             Get-MailboxStatistics |
  24.             Select-Object @SO_Params |
  25.             Format-Table –autosize}
  26.     }
Add Comment
Please, Sign In to add comment