Month: May 2014

Quick script to re-associate logins with users that have the same name. If the user in the database is named the same as the login and has no login currently associated with it, it will set the database user to use the login with the same name. Apparently, you can’t do this directly via powershell by setting the users’ login to the login name, as it errors out with “Modifying the Login property of the User object is not allowed. You must drop and recreate the object with the desired property.” Hence the SQL call to sync up the user.

Quick post on how to add a database role to all your databases and grant EXEC to said role. This will also add the specified user to said role (aptly named db_exec). Use with caution, minimally tested.