June 17, 2014 at 10:04 am
Morning, all.
Is there a way to query the LDAP from inside the CMS? I know I can add a linked server in a singular instance but I'd like to do it inside a server group. I haven't found anything so far about querying the LDAP inside a server group so it might not be possible?
Erin :unsure:
June 17, 2014 at 4:09 pm
What's the end goal here?
June 17, 2014 at 4:11 pm
No. The linked server would have to exist with the same name on every server in the group.
Edit: Of course, the query batch could create a linked server, use it, and then drop it.
June 18, 2014 at 10:43 am
mrdenny (6/17/2014)
What's the end goal here?
The ultimate goal is to verify that a given username exists in the ldap before querying a registered group looking for that username. Any alternate ideas? We currently user a variable containing the username but I wanted to be able to verify the information in that variable before querying the entire group.
So we have a thought but it would require that we be able to pick the order in which the servers in a registered group are queried. Is that possible?
June 18, 2014 at 12:17 pm
If I'm understanding you correctly, you can use the built-in function SUSER_SID() to verify if the account exist. If it returns NULL, it doesn't exist:
Declare @User nvarchar(256) = N'SQLMCMLap\TestUser',
@sid varbinary(85);
Set @sid = SUSER_SID(@User);
If @sid Is Not Null
Begin
--Do work
End
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply