Get-SqlObjectPermission

Gets an SMO ObjectPermissionInfo object.

Syntax

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

Detailed Description

The Get-SqlObjectPermission function gets a collection of SMO ObjectPermissionInfo objects for the specified database.

Related Commands

* Get-SqlObjectPermission

Parameters

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

Input Type

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

Return Values

Microsoft.SqlServer.Management.Smo.ObjectPermissionInfo Get-SqlObjectPermission returns a Microsoft.SqlServer.Management.Smo.ObjectPermissionInfo object.

Notes

Additional properties including the effective members of the ObjectPermissionInfo are returned. Nested AD/local groups are recursively enumerated and returned in a flat structure. SQL 2000 does not support this SMO method, instead a System.DataRow is returned of object permissions.

Examples

EXAMPLE 1

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

EXAMPLE 2

Get-SqlDatabase "Z002\sql2K8" | Get-SqlObjectPermission
This command gets a collection of SMO ObjectPermissionInfo objects for all user databases on SQL Server Z002\SQL2K8.