Compare SQL Server users to AD users

Asked

Viewed 20 times

1

I need to raise users of an instance that no longer exist in the AD for cleaning these. Is there any way to compare AD users with windows Authentication users of an SQL instance?

  • Your question seems to me very generic and speculative. I could edit it and provide a minimum and verifiable example?

  • Hello Rodrigo, I will complement the doubt... I have an instance that has several logins of employees who are no longer working in the company, for audit purposes I need to revoke those logins that no longer exist in AD but which remain with your existing Windows Authentication users in the instance, then I wonder if there is a way to connect in AD and make this comparison query without needing Linked server.

1 answer

0

Hello @rafaabell, you can use the stored system processor sp_validatelogins to display the logins of Windows employees who no longer exist and still remain in the SQL Server instance.

EXEC sp_validatelogins;  
GO 
  • Rodrigo thank you so much! It was exactly what I needed.

  • I’m glad I helped. I could mark my answer as useful and your question as answered?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.