How do I create logins for all database users in a database that was just restored for a different server? I was recently tasked with moving some databases to a new server. I created backups then restored the databases to the new server and it looks like the database users were retained, however there's no corresponding logins, prohibiting the users from accessing the new server. All of the users are domain users. Is there any way to iterate over the existing users in a database and create a login for each?
Google for sp_help_revlogin and find the version for your version of SQL (the SQL 2008 version works on SQL 2008 and up).  Install this sp on the old server.  Run sp_help_revlogin on the old server.  Take the output and put it in a query window on the new server, and run the query to create all the logins.