Get-SqlDatabaseRole

Returns a SMO DatabaseRole object with additional properties.

Syntax

Get-SqlDatabaseRole [-database] <Database> [<CommonParameters>]

Detailed Description

The Get-SqlDatabaseRole function gets a collection of SMO DatabaseRole objects for the specified SQL Database.

Related Commands

* Get-SqlDatabaseRole

Parameters

Name Description Required? Pipeline Input Default Value
database    true  true (ByValue)   

Input Type

Microsoft.SqlServer.Management.Smo.Database You can pipe database objects to Get-SqlDatabaseRole

Return Values

Microsoft.SqlServer.Management.Smo.DatabaseRole Get-SqlDatabaseRole returns a Microsoft.SqlServer.Management.Smo.DatabaseRole object.

Notes

Additional properties are returned including the effective members of a role recursiving enumerates nested roles, and Windows Groups.

Examples

EXAMPLE 1

Get-SqlDatabaseRole $(Get-SqlDatabase "Z002\sql2K8" pubs)
This command gets a collection of SMO DatabaseRole objects for SQL Server Z002\SQL2K8, pubs database.

EXAMPLE 2

Get-SqlDatabase "Z002\sql2K8" | Get-SqlDatabaseRole
This command gets a collection SMO DatabaseRole objects for all SQL databases on the SQL Server Z002\SQL2K8.