Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

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!)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.