FOR EACH DB:
exec sp_MSforeachdb '
IF(''?'' NOT IN (''master'',''tempdb'',''model'',''msdb'',''distribution'',''redgate''))
BEGIN
USE ?
select ''?''
exec sp_helpuser
--select ''?'', user_name(grantee_principal_id) as usrname, type,permission_name,state_desc from sys.database_permissions where user_name(grantee_principal_id) not in (''public'',''dbo'',''guest'') and user_name(grantee_principal_id) not like ''%##%''
END
'