Script Server Roles

  • Comments posted to this topic are about the item Script Server Roles

  • Hi Rasmus,

    it is possibly to simplify your script up to one select statement ;-):

    SELECT 'EXEC sp_addsrvrolemember '''+pr.name+''', '''+pm.name+''''

    FROM sys.server_role_members AS rm

    JOIN sys.server_principals AS pm ON rm.role_principal_id=pm.principal_id

    JOIN sys.server_principals AS pr ON rm.member_principal_id=pr.principal_id

    WHERE pr.name <> 'sa'

    AND pr.name NOT LIKE 'NT SERVICE%'

    AND pr.name NOT LIKE 'NT AUTHORITY%'

    Kind regards,

    Andrei

  • Thank You!

    --First Create sp_help_revlogin and use it to migrate logins

    --Second run this to update the server roles

  • Thanks for the script.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply