Exchange 2010 PowerShell设置ProhibitSendQuota等于ProhibitSendReceiveQuota

我需要将Exchange邮箱属性ProhibitSendQuota设置为与ProhibitSendReceiveQuota相等,但是我的PowerShell失败,如下所示:

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 

任何build议? 非常感谢您的帮助!

我build议尝试:

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

几个注意事项:

– 设置邮箱已经接受pipe道中的一个对象,你不需要“$ _”。

– “”等于string。 您可以从错误中看出PowerShell不会期望string值和barfs。 在实际的CmdLet被执行之前,使用paranthesis来评估pandant中的expression式(就像在math中一样!)