0 votes

I am trying to do a bulk update of a few custom properties that I added. I read this article Custom Properties in Search & PowerShell?. But I am not able to retrieve the custom attributes.
e.g.,
user.Get("adm-CustomAttributeText1") throws an unhandled exception: Adaxes.Adsi.DirectoryComException: the 'adm-CustomAttributeText1' property cannot be found in the cache.

I am able to get other AD properties using the Get, e.g, user.Get("samAccountName") works

by (730 points)

1 Answer

0 votes
by (216k points)

Hello,

The Get method of the IADs interface raises such an exception when the property is empty (not set for the directory object). That is why it is usually recommended to call the method using a try...catch block, for example:

try
{
     $myValue = $user.Get("adm-CustomAttributeText1")
}
catch
{
     # TODO: code for handling situations when the property is empty
}
0

Perfect, works fine after I updated the value using Put!

Related questions

0 votes
1 answer

I'm working on trying to update a script for updating office addresses on-demand. I'd like to leverage ADSI for this and I see that you can clear all condition sets ... seeing a documentation gap here or I'm running past the method needed for this. Thanks!

asked Jan 30, 2023 by AbbyR (40 points)
0 votes
1 answer

I'm wanting to store information in a custom user attribute in Entra ID but I'm wondering if this is possible within a "Update the user" action in Adaxes? ... PowerShell? https://learn.microsoft.com/en-us/entra/external-id/customers/concept-user-attributes

asked Dec 11 by smcfarland (60 points)
0 votes
1 answer

Is it possible to add Exchange custom attributes to users self-service portal and allow users to edit/modify them? Background, we're looking at setting up Office ... service account to perform the updates. We would prefer not changing permissions if possible.

asked Sep 15, 2022 by Subz (20 points)
0 votes
1 answer

Hi I know this isn't currently possible, but is the ability to use Adaxes custom attributes in a Business Unit Criteria something you are looking into? It would make the business units far more powerful and usable than they currently are. Thanks Matt

asked Nov 30, 2022 by chappers77 (2.0k points)
0 votes
1 answer

Hi I'm wondering how we can use the custom attributes we can set when creating a new container in Adaxes? As an example, I would like to use one for the ... how would we go about updating the attribute once the certificate has been renewed? Thanks Matt

asked Apr 28, 2021 by chappers77 (2.0k points)
3,588 questions
3,277 answers
8,303 comments
548,090 users