/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


HELP! Install / Uninstall software based on AD group membership (LDAP label)

07/21/2016 1132 views
Hey all, looking to get a little help with the removal of software based on an LDAP label.

There are two parts of this. The first is installing the software automatically based on an LDAP label when a user is added to the specific AD security group. That one works great. Here's the SQL for that.

SELECT 
    MACHINE.NAME,
    MACHINE.OS_NAME,
    MACHINE.USER_NAME,
    MACHINE.USER_FULLNAME
FROM
    LABEL L
        LEFT JOIN
    USER_LABEL_JT ON (USER_LABEL_JT.LABEL_ID = L.ID)
        LEFT JOIN
    USER U ON (U.ID = USER_LABEL_JT.USER_ID)
        LEFT JOIN
    MACHINE ON (MACHINE.USER_NAME = U.USER_NAME)
WHERE
    ((L.NAME LIKE 'MemberOf - LDAP USER LABEL HERE')
        AND (NOT EXISTS( SELECT 
            1
        FROM
            SOFTWARE,
            MACHINE_SOFTWARE_JT
        WHERE
            MACHINE_SOFTWARE_JT.MACHINE_ID = MACHINE.ID
                AND SOFTWARE.ID = MACHINE_SOFTWARE_JT.SOFTWARE_ID
                AND SOFTWARE.DISPLAY_NAME = 'SOFTWARE 1')))

The issue that I am trying to solve is essentially reversing the label so that when a user is removed from the AD security group and subsequently no long in the LDAP label that the software automatically gets removed. I would think that this should be as simple as (If software exists and label does not then do something). However despite my best efforts is just is not working as I believe it should.

Any help here would be much appreciated.
0 Comments   [ + ] Show comments

Comments


Be the first to answer this question

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ