Get‑SqlDscLogin - dsccommunity/SqlServerDsc GitHub Wiki

SYNOPSIS

Gets SQL Server logins.

SYNTAX

Get-SqlDscLogin [-ServerObject] <Server> [[-Name] <String>] [-Refresh] 
 [<CommonParameters>]

DESCRIPTION

Retrieves login objects from a SQL Server Database Engine instance. Specify -Name to return a specific login, or omit -Name to return all logins. Use -Refresh to refresh the login collection before retrieval.

EXAMPLES

EXAMPLE 1

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Get-SqlDscLogin -Name 'MyLogin'

Get the login named MyLogin.

PARAMETERS

-Name

Specifies the name of the server login to get.

Type: String
Parameter Sets: (All)
Aliases:

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

-Refresh

Specifies that the ServerObject logins should be refreshed before trying to get the login object. This is helpful when logins might have been modified outside of the ServerObject, for example through T-SQL. On instances with a large number of logins, consider ensuring the ServerObject is recent enough.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ServerObject

Specifies the current server connection object.

Type: Server
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Microsoft.SqlServer.Management.Smo.Server

Accepts input via the pipeline.

OUTPUTS

Microsoft.SqlServer.Management.Smo.Login

Returns a single Login object when the Name parameter is specified and a

match is found.

Microsoft.SqlServer.Management.Smo.Login[]

Returns an array of Login objects when the Name parameter is not specified

(returns all logins) or when multiple matches are found.

NOTES

RELATED LINKS

⚠️ **GitHub.com Fallback** ⚠️