USP_ADORGANIZATIONALUNIT_GETPATHANDUSERINFOLIST

Returns a list of organizational units, including the path and credentials used to open the Active Directory organizational unit

Definition

Copy


CREATE procedure dbo.USP_ADORGANIZATIONALUNIT_GETPATHANDUSERINFOLIST
as
begin

    set nocount on;

    --open key to decrypt USERPWD value

    exec dbo.USP_GET_KEY_ACCESS;

    select 
        [NAME], OUPATH, USERNAME, 
        CAST(DecryptByKey(USERPWD) AS NVARCHAR(128)) as USERPWD_DECRYPTED,
        USERACCOUNTSID
    from dbo.ADORGANIZATIONALUNIT

    close symmetric key sym_BBInfinity;

    return 0;
end