Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Trying to use Get-Mailbox

$
0
0

I am trying to get a script that prompts the user to enter a username to search, and then returns with the name, how much storage they have used, and all the quotas set for that user. But I am having troubles using Get-Mailbox a second time in the script. It seems to get completely ignored when I am running it, but compiles perfectly fine and I don't have any errors.

Why is the second Get-Mailbox ignored? What can I do to still have everything in the same script?

I've found that the Get-Mailbox still runs, but the table it should output is being ignored. I have tried using other things such as Write-Output $x after storing my second Get-Mailbox into $x but it still does not display in the script. Can I not show 2 different tables in the same script?

. 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto
$user = Read-Host -Prompt 'Enter Username to Check Quota'

Get-Mailbox -Identity $user | Get-MailboxStatistics | Select DisplayName, `

  @{name=”TotalItemSize (MB)”; expression={[math]::Round( `

  ($_.TotalItemSize.ToString().Split(“(“)[1].Split(” “)[0].Replace(“,”,””)/1MB),2)}} `
  , StorageLimitStatus

Get-Mailbox -Identity $user | Select Name,ProhibitSendQuota,IssueWarningQuota,ProhibitSendReceiveQuota 



Viewing all articles
Browse latest Browse all 21975

Trending Articles