0 votes

We are currently working on automating the property patterns. So far we were able to add all the needed properties to a Property Pattern via PowerShell script apart from the Value Selection for the "Exchange Mailbox Store" property.

We tried to add the "homeMDB" property in the script but were unable to add a default value of 1 Mailbox DB and the constraints that only one selection can be made (like in the screenshot).

This is what it should look like: image.png

We tried different approaches and in the code block bellow is the latest. Also we could't find any information for this in the SDK.

$DBS = @()
$DBS += "MBDB_DB1"

$item = $pattern.Items.Create()
$item.PropertyName = "homeMDB"
$item.IsPropertyRequired = $true

$constraints = $item.GetConstraints()
$constraint = $constraints.Create("ADM_PROPERTYCONSTRAINTTYPE_VALUERANGE")
$constraint.Values = $DBS
$constraints.Add($constraint)
$item.SetConstraints($constraints)


# Save the changes
$item.SetInfo()
$pattern.Items.Add($item)

The following image shows the result of the code above, which doesn't quite match the "should be" screenshot. image.png

Any help would be much appriciated.

by (60 points)

1 Answer

+1 vote
by (294k points)
selected by
Best answer

Hello Michael,

You need to use the following code block in your script. In the code, the $dbGUIDs variable specifies GUIDs of databases that will be available for selection.

$dbGUIDs = @("0904298E-F6B8-4BAB-8A54-1B055F0EFA98") # TODO: modify me

# Create item
$item = $pattern.Items.CreateEx("adm-MailboxStoragePropertyPatterntItem")
$item.PropertyName = "homeMDB"
$item.IsPropertyRequired = $true

$item.MailboxStorageSelectionType = "ADM_MAILBOXSTORAGESELECTIONTYPE_ROUNDROBIN"
$item.AllowedMailboxStorageDatabases = $dbGUIDs

# Save the changes
$item.SetInfo()
$pattern.Items.Add($item)

Related questions

0 votes
1 answer

Or is there another solution to solve this?

asked Sep 15, 2022 by boris (550 points)
0 votes
1 answer

I want to make a custom field in which you can select a person from the active directory, is this possible? For example, as in the field manager

asked Nov 18, 2022 by Alvares (100 points)
0 votes
1 answer

Hi, we have replaced our local Exchange server with installation of Exchange Management Tools (EMT) installed directly on Adaxes server. And my question is: How can I force ... this is how 'Set External Senders' option looks in Adaxes config Thanks in advance

asked Apr 1, 2023 by KIT (960 points)
0 votes
1 answer

I want to disable exchange mail account via script. This script will run in custom command. I write a script like this. "Disable-Mailbox -identity %mailNickname% - ... module that it is recognize this command. Any one suggest something Thanks in advanced.

asked Jul 1, 2013 by Erkan.Ozturk (40 points)
0 votes
1 answer

When I add the property MsExchActiveSyncEnabled it seems to always be blank. How to fix?

asked Apr 22, 2022 by nate2 (90 points)
3,588 questions
3,277 answers
8,303 comments
548,091 users