Add-SqlServerRoleMember

Adds a login to a server role.

Syntax

Add-SqlServerRoleMember [-sqlserver] <Object> [-loginame] <String> [-rolename] <String> [<CommonParameters>]

Detailed Description

The Add-SqlServerRoleMember function adds a login to the specified server role.

Related Commands

* Add-SqlServerRoleMember

Parameters

Name Description Required? Pipeline Input Default Value
sqlserver    true  false   
loginame    true  false   
rolename    true  false   

Input Type

None You cannot pipe objects to Add-SqlServerRoleMember

Return Values

None This function does not generate any output.

Examples

EXAMPLE 1

Add-SqlServerRoleMember "Z002\sql2k8" "TestPSUnit" "bulkadmin"
This command adds the TestPSUnit login to the bulkadmin server role.

EXAMPLE 2

$server = Get-SqlServer "Z002\sql2k8"
Add-SqlServerRoleMember $server "TestPSUnit" "bulkadmin"
This command adds the TestPSUnit login to the bulkadmin server role.