Multiple issues regarding attributes

I created a virtual attribute and linked it to a class that isn't a user or a group. It's actually a class that was implemented through a schema extension. I also created a workflow policy and the first step is to search for objects of this class. Unfortunately, the attributes linked to this class is not available. I passed the search results to a save object properties step. Going through the steps of adding the attributes I need still doesn't display them. Instead, I'm shown user class attributes. Is there a way to get it to display the appropriate attributes for this class of object?

The next issue, I decided to do a custom script. I am able to retrieve the attributes via this method using the Get-ADObject CMDLET. Now I need to update a virtual attribute based on the data received. I've seen scripts on how to append data but haven't seen any examples to remove just specific line items. How would I go about doing this?

I want to append some data and remove other data from the same virtual attribute. Preferably on the same line if possible.

  • When you say...

    Preferably on the same line if possible.

    Is all of the data you want to edit contained in a single virtual attribute?

    Here's a list snippet you might find helpful

    $MyVAContents = Get-QADObject -proxy -identity $MyObject -includedproperties MyVaName | select -expandProperty MyVAName

    # Assume this returns something like this:  FirstData;SecondData;ThirdData

    # Data is delimited by a semi-colon

    # Break the VA's contents into various elements of a list

    $MyVAContentsList = $MyVAContents.Split(";")

    # Edit the second element of the list

    $MyVAContentsList[1] = "NewSecondData"

    # Reassemble the contents of the VA

    $MyNewVAContents = $MyVAContentsList -join ";"

    Set-QADObject -proxy -identity $MyObject -ObjectAttributes @{MyVaName=$MyNewVAContents}

  • The virtual attribute is a multi-valued attribute. So when I do expandproperty, it will have each item on a separate line already. No need to split.

    The way you coded it, overwrites the attribute entirely correct? I don't want to overwrite it, I want to add some lines to the existing data and only remove specific entries on the same attribute. I saw some examples where they used append with the ObjectAttributes parameter. That handles the use case to add information. But how do I remove only a specific entry?