Microsoft SQL and orphaned users

This post is just a little note for me and little collection of steps I found and used (and wrote down not to forget 😉 ).

Find orphaned users:

With this little script we can get list of all orphaned users in all DBs. Now we have 2 options. First we select the DB (doesn’t matter if in GUI of Managemetn studio or with USE ‘db’) and then we can create new login and fix the orphan:

Or only fix the orphan with already existing user

 

 

 

Thanks for support:
https://gallery.technet.microsoft.com/scriptcenter/List-out-Orphan-User-fccf2867
http://www.fileformat.info/tip/microsoft/sql_orphan_user.htm

Leave a Comment

Your email address will not be published. Required fields are marked *