Set-SqlObjectPermission

Sets database object level permissions.

Syntax

Set-SqlObjectPermission [-smo] <Object> [-permission] {Alter | Control | Connect | Delete | Execute | Impersonate | Insert | Receive | References | Select | Send | TakeOwnership | Update | ViewDefinition | ViewChangeTracking} [-name] <String> [-action] <String> [<CommonParameters>]

Detailed Description

The Set-SqlObjectPermission function sets database object level permissions.

Related Commands

* Set-SqlObjectPermission

Parameters

Name Description Required? Pipeline Input Default Value
smo    true  true (ByValue)   
permission    true  false   
name    true  false   
action    true  false   

Input Type

Microsoft.SqlServer.Management.Smo.* You can pipe SMO objects to Set-SqlObjectPermission

Return Values

None This function does not generate any output.

Examples

EXAMPLE 1

$database = Get-SqlDatabase "Z002\sql2k8" "pubs"
$database | get-sqlschema -name dbo | set-sqlobjectpermission -permission Select -name TestPSUnit -action Grant
This command grants select permission on the dbo schema to the TestPSUnit user.