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 (290 points)

1 Answer

+1 vote
by (177k 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

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 (450 points)
0 votes
1 answer

hello, I have somethings like this : #Start the process on the remote machine $Context.LogMessage("Get statistivcs on %cn%", "Information") $Server = New-PSSession -ComputerName ... main script so I can see $a in $Context.LogMessage. is that possible? Thanks.

asked Feb 13, 2018 by tentaal (5.4k points)
0 votes
1 answer

Hello again! I'm building a script that will create Adaxes Security Roles for each new customer we bring on I'm trying to create a Role with the ability to change ... properties for user or group objects it would really help me get the script finished up.

asked Nov 14, 2015 by drew.tittle (4.5k points)
0 votes
0 answers

Softerra Adaxes provides role-based security administration, so permissions are granted to users with the help of Security Roles. To view the Security Roles that delegate permissions ... delegated, right-click a Security Role and click Locate Role in Tree.

asked Apr 23, 2009 by Support (215k points)
0 votes
1 answer

I have an ADP Sync scheduled task that modifies and creates users from a csv file. I also have reports that show new users created and management history for user ... ADP Sync scheduled task so that they only run after the ADP Sync task is complete?

asked Jan 7 by barberk (290 points)
2,183 questions
1,948 answers
5,392 comments
5,257 users