Exchange 2007 PowerShell Filter problem
RetentionHoldEnabled is not a filterable property. It does not show up in ADSIedit.So how do you get a list of mailboxes that have -RetentionHoldEnabled $true? [PS] C:\Windows\System32>Get-Mailbox -filter "RetentionHoldEnabled -eq 'true'"Get-Mailbox : Cannot bind parameter 'Filter' to the target. Exception setting "Filter": ""RetentionHoldEnabled" is not a recognized filterable property. For acomplete list of filterable properties see the command help."RetentionHoldEnabled -eq 'true'" at position 1."At line:1 char:20+ Get-Mailbox -filter <<<< "RetentionHoldEnabled -eq 'true'" You can set a ManagedFolderMailboxPolicy on a mailbox then dump the mailbox properties and seethat the policy was set. However, you can't get a list of which mailboxes have that policy assigned. [PS] C:\Windows\System32>Set-Mailbox -Identity testx94t1 -ManagedFolderMailboxPolicy 'DeleteItemsOver60DaysOld' [PS] C:\Windows\System32>Get-Mailbox -Identity testx94t1 | FL Database : BCCLABX05\First Storage Group\Mailbox Da tabaseDeletedItemFlags : DatabaseDefaultUseDatabaseRetentionDefaults : TrueRetainDeletedItemsUntilBackup : FalseDeliverToMailboxAndForward : FalseRetentionHoldEnabled : TrueEndDateForRetentionHold :StartDateForRetentionHold :ManagedFolderMailboxPolicy : DeleteItemsOver60DaysOldExchangeGuid : bdccd4ac-7fbf-4811-a895-8b43d6d557c3ExchangeSecurityDescriptor : System.Security.AccessControl.RawSecurit yDescriptorExchangeUserAccountControl : NoneExternalOofOptions : ExternalForwardingAddress :RetainDeletedItemsFor : 14.00:00:00IsMailboxEnabled : TrueLanguages : {}OfflineAddressBook :ProhibitSendQuota : 2GBProhibitSendReceiveQuota : 2355MBDowngradeHighPriorityMessagesEnabled : FalseProtocolSettings : {HTTP11, OWA1}RecipientLimits : unlimitedUserAccountControl : NormalAccountIsResource : FalseIsLinked : FalseIsShared : FalseLinkedMasterAccount :ResourceCapacity :ResourceCustom : {}ResourceType :SamAccountName : TestX94T1SCLDeleteThreshold :SCLDeleteEnabled :SCLRejectThreshold :SCLRejectEnabled :SCLQuarantineThreshold :SCLQuarantineEnabled :SCLJunkThreshold :SCLJunkEnabled :AntispamBypassEnabled : FalseServerLegacyDN : /o=Tesoro/ou=Exchange Administrative Gro up (FYDIBOHF23SPDLT)/cn=Configuration/cn =Servers/cn=BCCLABX05ServerName : bcclabx05UseDatabaseQuotaDefaults : FalseIssueWarningQuota : 1945MBRulesQuota : 64KBOffice :UserPrincipalName : TestX94T1@tsoextest.localUMEnabled : FalseMaxSafeSenders :MaxBlockedSenders :Extensions : {}AcceptMessagesOnlyFrom : {}AcceptMessagesOnlyFromDLMembers : {}AddressListMembership : {Default Global Address List, All Users}Alias : TestX94T1OrganizationalUnit : tsoextest.local/UsersCustomAttribute1 :CustomAttribute10 :CustomAttribute11 :CustomAttribute12 :CustomAttribute13 :CustomAttribute14 :CustomAttribute15 :CustomAttribute2 :CustomAttribute3 :CustomAttribute4 :CustomAttribute5 :CustomAttribute6 :CustomAttribute7 :CustomAttribute8 :CustomAttribute9 :DisplayName : Test, X94T1EmailAddresses : {smtp:XTest@tsoextest.local, X400:C=US;A = ;P=Tesoro;O=Exchange;S=Test;G=X94T1;, SMTP:X94T1.Test@tsoextest.local}GrantSendOnBehalfTo : {}HiddenFromAddressListsEnabled : FalseLegacyExchangeDN : /o=Tesoro/ou=Exchange Administrative Gro up (FYDIBOHF23SPDLT)/cn=Recipients/cn=Te stX94T1MaxSendSize : unlimitedMaxReceiveSize : unlimitedPoliciesIncluded : {{9343618B-81EE-4338-A5C4-8F529090D2A4}, {26491CFC-9E50-4857-861B-0CB8DF22B5D7}}PoliciesExcluded : {}EmailAddressPolicyEnabled : TruePrimarySmtpAddress : X94T1.Test@tsoextest.localRecipientType : UserMailboxRecipientTypeDetails : UserMailboxRejectMessagesFrom : {}RejectMessagesFromDLMembers : {}RequireSenderAuthenticationEnabled : FalseSimpleDisplayName :UMDtmfMap : {}WindowsEmailAddress : X94T1.Test@tsoextest.localIsValid : TrueOriginatingServer : bcclabdc01.tsoextest.localExchangeVersion : 0.1 (8.0.535.0)Name : Test, X94T1DistinguishedName : CN=Test\, X94T1,CN=Users,DC=tsoextest,DC =localIdentity : tsoextest.local/Users/Test, X94T1Guid : 005d02ea-02a9-47b5-a5d5-8ccf5aed1af2ObjectCategory : tsoextest.local/Configuration/Schema/Per sonObjectClass : {top, person, organizationalPerson, user }WhenChanged : 8/20/2009 8:58:17 AMWhenCreated : 8/9/2009 3:26:09 PM [PS] C:\Windows\System32>Get-Mailbox -filter "ManagedFolderMailboxPolicy -eq 'DeleteItemsOver60DaysOld'"[PS] C:\Windows\System32> (nothing returned) [PS] C:\Windows\System32>Get-Mailbox -filter "ManagedFolderMailboxPolicy -ne 'DeleteItemsOver60DaysOld'" Name Alias ServerName ProhibitSendQuo ta---- ----- ---------- ---------------O2K7E2K7 O2K7E2K7 bcclabx05 unlimitedO2K3E2K7 O2K3E2K7 bcclabx05 unlimitedO3E3-O3E7 O3E3-O3E7 bcclabx05 unlimitedO3E3-O7E7 O3E3-O7E7 bcclabx05 unlimited1-11C032 (10) 1-11C032 bcclabx05 unlimitedCatering Order #1 CateringOrder1 bcclabx05 unlimited1-L050A 1-L050A bcclabx05 unlimited1-11D034 (12) 1-11D034 bcclabx05 unlimited1-L108 (8) 1-L108 bcclabx05 unlimited1-L120 (4) 1-L120 bcclabx05 unlimited1-L200 (10) 1-L200 bcclabx05 unlimited1-L150B 1-L150B bcclabx05 unlimitedBCCLABX94 Test BCCLABX94Test bcclabx05 2GBUser, Sample UserSample bcclabx05 unlimitedTest, X94T1 TestX94T1 bcclabx05 2GBTest, X94T2 TestX94T2 bcclabx05 2GBTest, X94T3 TestX94T3 bcclabx05 2GBTest, X94T4 Test?X94T4 bcclabx05 2GB1cdvlm 1cdvlm bcclabx01 unlimitedJohnson Jr, Marvin JohnsoM bcclabx01 unlimitedBlack, Richard H BlackRH bcclabx01 unlimitedTest, BCCLabX01 Test_BCCLabX01 bcclabx01 unlimitedO2K3E2K3 O2K3E2K3 bcclabx01 unlimitedDoe, John A DoeJA bcclabx01 unlimitedDoe, John C DoeJC bcclabx01 unlimitedDoe, John D DoeJD bcclabx01 unlimitedDoe, Tom DoeT bcclabx01 unlimitedDoe, John E DoeJE bcclabx01 unlimitedDoe, John F DoeJF bcclabx01 unlimitedDoe, John G DoeJG bcclabx01 unlimitedVan Fleet, Blake VanFleetB bcclabx01 unlimitedVan Zandt, Joe T VanZandtJT bcclabx01 unlimitedO'Hern, Dennis T O'HernDT bcclabx01 unlimitedBanuelos-Macias, Gina T Banuelos-MaciasGT bcclabx01 unlimitedBanuelos_Macias, Joe T Banuelos_MaciasJT bcclabx01 unlimitedBlankMI, John BlankMIJ bcclabx01 unlimitedMultipleMI, John MMI MultipleMIJ bcclabx01 unlimitedTest, BCCLabx02 Test_BCCLabX02 bcclabx02 unlimited [PS] C:\Windows\System32>
August 20th, 2009 6:15pm

If server side filtering doesn't have attribute to filter, then you can use client side filtering... get-mailbox -recipientsize unlimited | where {$_.retentionholdenabled -eq $true} get-mailbox -recipientsize unlimited | where {$_.ManagedFolderMailboxPolicy-eq "deleteItemsOver60DaysOld"} get-mailbox -recipientsize unlimited | where {$_.ManagedFolderMailboxPolicy-ne "deleteItemsOver60DaysOld"}Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2009 6:25pm

Thanks that worked when I changed -recipientsize to -resultsize unlimited.
August 20th, 2009 8:57pm

Amit's answer is a good work around but the Server Side Filter is still broke and needs to be fixed. If the Server Side filter worked correctly it would be more efficient. ManagedFolderMailboxPolicy is a filterable parameter and the syntax is correct, so it should return a list of mailboxes that are assigned to that policy. RententionHold Enabled is not a filterable parameter but should be. I can't be the only person who needs to know what mailboxes are on Retention Hold.
Free Windows Admin Tool Kit Click here and download it now
August 21st, 2009 1:18am

Rich, ManagedFolderMailboxPolicyworkedwith server side filtering for me... Get-Mailbox -resultsize unlimited -filter {ManagedFolderMailboxPolicy -eq 'Name'} Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
August 21st, 2009 5:50am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics