How to create a policy that will periodically check the membership of sysadmin?

  • Specifically, I need to know how to set up the condition. In other words, which facet and properties do I use to set up such a policy? Thank you!!!!!!

  • Please put your question in the post, not the subject. It cuts off and can't be read.

  • Sorry, you also need to define what you mean by "check"? How does SQL Server know when the policy fails?

  • I am going straight out of the MS SQL Server 2008 Training Kit, chapter review for Policy Based Management. Suggested Practice:

    "Configure policies to checkthe membership of the sysadmin and db_owner roles".

    In this context does this make more sense?

  • Has anyone has a solution to this question as i also need some tutorials on Policy based management on sql 2008.

    please guys.

  • Can you explain what you wrote in 'field' part? The part starting with ExecuteSql...

  • and I think, these code returns all sysadmin groups. I also need to get some of the sysadmin groups. For example I want to check if one desired group is sysadmin or not.

  • It's a SQL statement in the field textbox, Google ExecuteSQL. The select statement is:

    SELECT serverroles.name

    FROM sys.server_principals AS serverroles

    JOIN sys.server_role_members serverrolemembers

    ON serverrolemembers.role_principal_id = serverroles.principal_id

    JOIN sys.server_principals serverrolemember

    ON serverrolemembers.member_principal_id =

    serverrolemember.principal_id

    WHERE serverrolemember.name = 'BUILTIN\Administrators'

    You can change the where clause if your interested in more than just the 'BUILTIN\Administrators' group.

  • Now I have another question. I want to check if default port is 1433 or not. If so, when I evaluate the condition I want to see "x" in target details part.. However, I could not create condition, it gives an error "make sure string constants are enclosed in single quotes and facet properties are prefixed with "@" sign." and I can not click "ok".

    How do you think I can solve this problem?

    And here it is the script I've been tring to create condition.

    ExecuteSql('Numeric','declare @server as varchar(128)

    declare @KeyToInterogate as varchar(200)

    declare @Version as varchar (512)

    declare @PortNumber as varchar(8)

    set @server = @@ServerName

    set @Version = left(@@Version, 38)

    set @KeyToInterogate = 'SOFTWARE\MICROSOFT\MSSQLSERVER\MSSQLSERVER\SUPERSOCKETNETLIB\TCP'

    if charindex('\',@@ServerName) > 0

    begin

    set @KeyToInterogate = 'SOFTWARE\Microsoft\Microsoft SQL Server\'

    set @KeyToInterogate = @KeyToInterogate + substring(@@ServerName,charindex('\',@@ServerName) + 1,len(@@ServerName) - charindex('\',@@ServerName))

    set @KeyToInterogate = @KeyToInterogate + '\MSSQLServer\SuperSocketNetLib\Tcp'

    end

    exec xp_regread

    @rootkey = 'HKEY_LOCAL_MACHINE',

    @key = @KeyToInterogate,

    @value_name = 'TcpPort',

    @value = @PortNumber output

    select @PortNumber

    ')

Viewing 10 posts - 1 through 9 (of 9 total)

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