Skip to content

Get-DatabaseSecurity

SYNOPSIS

Retrieve the security settings of a SQL Server database.

SYNTAX

Get-DatabaseSecurity [[-SQLDb] <String>] [[-SQLserver] <String>]

DESCRIPTION

This function retrieves the current security settings of a specified SQL Server database. It lists users/groups along with their respective roles and the type of credential (e.g., contained user at the database level).

EXAMPLES

EXAMPLE 1

Get-DatabaseSecurity -SQLDb "TestDB" -SQLServer "SQLInstance1"

Retrieves the security settings for the "TestDB" database on the "SQLInstance1" server.

EXAMPLE 2

Get-DatabaseSecurity -SQLDb "ProductionDB" -SQLServer "SQLInstance2.gentgrp.gent.be"

Retrieves the security settings for the "ProductionDB" database on the fully qualified server "SQLInstance2.gentgrp.gent.be".

PARAMETERS

-SQLDb

The name of the database for which the security settings will be retrieved.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SQLserver

The name of the SQL Server instance (preferably the FQDN). If not fully qualified, the domain ".gentgrp.gent.be" will be appended.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

NOTES