You can edit Multi Value Attributes with the PowerShell.
But if you use the usual techniques, existing content will be deleted.
Some small changes in the script line are the solution.
In a current project we want to use a CustomAttribute for the migration management. The different migration phases are saved with a Multi Value Attribute and trigger different processes in dependence of the values. For an AD Migration it is really great to have PowerShell and Multi Value Attributes do work together.
Index
All values of the Multi Value Attribute are deleted
When you try to store a new value to a Multi Value Attribute with the usual techniques, the existing content will be erased.
This line writes the value “phase1“ into the attribute msExchExtensionCustomAttribute1:
This example overwrites all the content, “phase1“ is replaced by “phase2“:
Add or delete values without problems
With a small change in the script line, you can easily achieve that values are added or single values are deleted:
@{Append
Adds one or more values
@{Delete
Deletes one or more values
@{Clear
Deletes all values
@{Update
Deletes all values and writes new ones
The following line adds the value “phase2” to an existing one
If you are little used to PowerShell, you can also delete values based on search criteria:
The example searches for values containing “New” while not paying attention to upper or lower case spelling (newvalue, NewValue, etc.).
$prop2del = “New“
foreach($prop in $src.msExchExtensionCustomAttribute1)
{
$prop
if($prop.ToLower().Contains($prop2del.ToLower()))
{
$result=Set-QADUser $account -objectAttributes @{msExchExtensionCustomAttribute1=@{Delete=@($prop)}}
}
}
Leave a Reply
<p>Your email is safe with us.<br/>Information about our <a href="https://activedirectoryfaq.com/contact-us/">data protection policies</a></p>