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

Value Format Issue

$
0
0

I'm running the following script and I am having a few issues with returning the "TotalItemSize" value and getting the "IssueWarningQuota" and "ProhibitSendQuota" values to be formatted the way i need them to be:

When i use the following code I'm returing the values below:
@{label="IssueWarningQuota";e={(get-mailbox -IgnoreDefaultScope $DN).IssueWarningQuota}}

Althought this is correct i need the values to be a number not a string and the size should be in MB. I've attempted to run the code below but I am not returing a value when I do.
@{label="IssueWarningQuota";e={(get-mailbox -IgnoreDefaultScope $DN).IssueWarningQuota.Value.ToMB()}}

Any ideas would help.

SCRIPT BLOCK
*********************************************************************************************

$DNs = Get-Mailbox -IgnoreDefaultScope | Select-object DistinguishedName -ExpandProperty DistinguishedName
 
 FOREACH($DN in $DNs)
 {
  Get-MailboxStatistics -Identity $DN `
  | Where {(!($_.StorageLimitStatus -match "BelowLimit|NoChecking"))} `
  | Select DisplayName,StorageLimitStatus,ItemCount,servername,`
  @{label="TotalItemSize";e={($_.TotalItemSize).Value.ToMB()}},`
  @{label="Alias";e={(get-mailbox -IgnoreDefaultScope $DN).alias}},`
  @{label="IssueWarningQuota";e={(get-mailbox -IgnoreDefaultScope $DN).IssueWarningQuota.Value.ToMB()}},`
  @{label="ProhibitSendQuota";e={(get-mailbox -IgnoreDefaultScope $DN).ProhibitSendQuota.Value.ToMB()}}
 }


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>