• Administration is not my forte, so you shouldn't take my advice as the only truth.

    But you can use something like this.

    declare @cmd1 varchar(500),

    @cmd2 varchar(500)

    set @cmd1 =

    'use ?; if ''?'' NOT IN( ''tempdb'', ''Master'', ''Model'', ''msdb'') print ''CREATE USER MyGroup FOR LOGIN Mydomain\MyGroup'''

    set @cmd2 =

    'use ?; if ''?'' NOT IN( ''tempdb'', ''Master'', ''Model'', ''msdb'') print ''EXEC sp_addrolemember ''''db_owner'''', ''''MyGroup'''''''

    exec sp_MSforeachdb @command1=@cmd1, @command2=@cmd2

    This code won't do anything, it will just print a script. You could modify it to make it work, but you should test a part of it first.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2