bulk publish outstanding ADSAccountInADSGroup

Hi

 

I want to publish a whole bunch of outstanding ADSAccountInADSGroup.

The Manager is very slow in loading all the outstandings, so I need to do it by SQL

 

Doing it with ADSGroups or ADSAccount wasn't a problem by using:

exec QBM_PJobCreate_HOFireEvent @objecttype, @whereclause, @EventName, @GenProcID;

 

But that doesn't work with ADSAccountInACSGroup.

Does anyone have an idea, how I can do this publishing without the Manager?

 

I'm using 7.1.1

  • Update:
    The exec QBM_PJobCreate_HOFireEvent didn't work for ADSGroups and ADSAccounts well, even it seemed so.

    So in general, who can a Publish Outstanding AD Objects without using the Manager?
  • I assume, because you haven't shared this detail, you just tried to fire the event HandleOutstanding.

    In that case, the publishing will not succeed because the state of the objects is still set to Outstanding.

    As I pointed out in another thread here in the community (https://www.quest.com/community/products/one-identity/f/identity-manager/21253/v7-7-bulk-delete-outstanding-objects), the outstanding handling had to change since version 7 because of the application server integration.

    Again, similar to the mentioned thread, I've created a script that takes a bunch of object keys that should be published. It uses the same type of code the controls in the manager are using to achieve that.

    Public Sub CCC_Entity_PublishOutStandingFromDB(ObjectKeys As IEnumerable(Of String))
    
        Dim f = Connection.SqlFormatter
    
        ' Set connection variable to hint about the management of OutStanding objects
        Session.Variables.Put("ManageOutstanding", True)
        Session.Variables.Put("NoCollisionTest", True)
        Session.Variables.Put("ManageOutstandingOperation", "Publish")
    
        ' Group the ObjectKeys by table
        Dim keysByTable = ObjectKeys _
    .Select(Function(k) New DbObjectKey(k)) _
    .GroupBy(Function(k) k.Tablename, StringComparer.OrdinalIgnoreCase)
    
        Try
    
            ' Create a unit of work here to optimize execution
            Using uow = Session.StartUnitOfWork()
    
                ' Iterate through the keys for each table
                For Each tableEntry In keysByTable
                    ' Partition the workload into junks defined by the limit of the IN clause.
                    For Each part In tableEntry.Partition(f.InClauseLimit)
    
                        ' Define the query for the current partition
                        Dim q = Query _
                        .From(tableEntry.Key) _
                        .Where(Function(t) t.Column("XObjectKey").In(part)) _
                        .SelectNonLobs()
    
                        ' Fetch a partition of the data using Bulk collection
                        Dim entities = Session.Source().GetCollection(q, EntityCollectionLoadType.Bulk)
    
                        ' For each entity of the collection
                        For Each e In entities
    
                            ' reset OutStanding flag
                            e.State = e.State And (Not EntityState.OutStanding)
    
                            ' put the entity to save in the unit of work
                            uow.Put(e)
                            Dim table = Session.MetaData().GetTable(e.Tablename)
                            If Not table.GetForeignKeys().Any(Function(fk) fk.PropagateRevisions) Then
                                uow.Generate(e, "HandleOutStanding")
                            End If
                        Next
                    Next
                Next
    
                ' Write the changes to the database
                uow.Commit()
            End Using
        Finally
            ' Remove the connection variable that hints about the management of OutStanding objects
            Session.Variables.Remove("ManageOutstanding")
            Session.Variables.Remove("NoCollisionTest")
            Session.Variables.Remove("ManageOutstandingOperation")
        End Try
    End Sub

    You just have to call that script with your bunch of object keys.

  • Hi Markus
    Cool, that works.
    Many thanks for that great script.

    For any other's trying this. Please don't forget to unmark the use transactions flag in the script tester options. ;)
  • Hi, 

    does it still works in the version 8.1 and later?

    ive tried it like this

    Public Sub CCC_Entity_PublishOutStandingFromDB_DO()
    Dim list1 As List(Of String) = New List(Of String)
    list1.Add("<Key><T>ADSAccountInADSGroup</T><P>2251fe15-a800-4eab-9634-9d3d6a628a7b</P><P>e7acd3db-1b45-44ef-a641-52fb0ff38c14</P></Key>")

    CCC_Entity_PublishOutStandingFromDB(list1)
    End Sub

    thanks

  • object adsaccountinadsgroup ist still outstanding, no job was created, like it would from manager

  • ive pastet it in to designer  

    and added    an extra xxx*_DO, which you see up there. 

    compiled and run without transaction. 

    i am sorry, it worked... ive checked it now, and it seems like it took a while... 

    haha. Sorry my bad... 

    since the action from manager comes instantly. 

    GREAT! amazing!

  • it took a while for domain controllers to replicate membership too. i have to be more patient