Enable‑SqlDscLogin - dsccommunity/SqlServerDsc GitHub Wiki
Enables a SQL Server login.
Enable-SqlDscLogin -ServerObject <Server> -Name <String> [-Force] [-Refresh]
[-WhatIf] [-Confirm] [<CommonParameters>]
Enable-SqlDscLogin -LoginObject <Login> [-Force] [-WhatIf] [-Confirm]
[<CommonParameters>]
This command enables a SQL Server login in a SQL Server Database Engine instance.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$loginObject = $serverObject | Get-SqlDscLogin -Name 'MyLogin'
$loginObject | Enable-SqlDscLogin
Enables the login named MyLogin.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Enable-SqlDscLogin -Name 'MyLogin'
Enables the login named MyLogin.
Specifies that the login should be enabled without any confirmation.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies a login object to enable.
Type: Login
Parameter Sets: LoginObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseSpecifies the name of the server login to be enabled.
Type: String
Parameter Sets: ServerObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies that the ServerObject's logins should be refreshed before trying to enable the login object. This is helpful when logins could have been modified outside of the ServerObject, for example through T-SQL. But on instances with a large amount of logins it might be better to make sure the ServerObject is recent enough, or pass in LoginObject.
Type: SwitchParameter
Parameter Sets: ServerObject
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies current server connection object.
Type: Server
Parameter Sets: ServerObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.