Copy Logins to another server with SIDs and passwords

I often need to replicate logins to another SQL Server where the SID and password (for SQL login types, not Windows based) need to be the same. The script below is executed against the source SQL Server and will generate the T-SQL to run on the target SQL Server:

The result looks like this (actual login name, SID and password altered):

Here is a screenshot of the query results:

GenerateSIDandPW-SQL

Views – 2470