0

I need to set the Exchange mailbox property ProhibitSendQuota equal as the ProhibitSendReceiveQuota, but my powershell fails as follows:

Get-Mailbox -Identity 'name.surname' | Set-Mailbox $_ -ProhibitSendQuota "$_.ProhibitSendReceiveQuota" -WhatIf

WARNING: The object has been corrupted, and it's in an inconsistent state. The following validation errors happened:
WARNING: The value of property 'ProhibitSendReceiveQuota' must be greater than or equal to that of property 'ProhibitSendQuota'. ProhibitSendReceiveQuota: '3.796 GB (4,075,520,000 bytes)', ProhibitSendQuota: '3.815 GB (4,096,000,000 bytes)'.

Cannot process argument transformation on parameter 'ProhibitSendQuota'. Cannot convert value ".ProhibitSendReceiveQuota" to type "Microsoft.Exchange.Data.Unlimited`1[Microsoft.Exchange.Data.ByteQuantifiedSize]". Error: "The string '.ProhibitSendReceiveQuota' isn't correctly formatted. It can contain a number with an optional unit specifier or the long ByteQuantifiedSize format. Examples include "12345", "104 MB", and "1 KB". Using the short format limits the string to 15 digits. However, the long format supports strings up to the maximum ByteQuantifiedSize value."
+ CategoryInfo          : InvalidData: (:) [Set-Mailbox], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-Mailbox

Any suggestion? Many thanks in advance for help!

1 Answer 1

2

I suggest trying:

Get-Mailbox -Identity 'name.surname' | Set-Mailbox -ProhibitSendQuota ($_.ProhibitSendReceiveQuota) -WhatIf

a few notes:

-Set-mailbox already accepts an object from the pipeline, you don't need the "$_".

-"" equals string. You can cleary see from your error that PowerShell doesnt expect a string value and barfs on it. Use paranthesis to evaluate an expression inside the paranthesis before the actual CmdLet is executed (just like in maths!)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .