Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Remove-DbaLogin on GitHub.
Want to see the Bill Of Health for this command? Check out Remove-DbaLogin.
Drops a Login
Tries a bunch of different ways to remove a Login or two or more.
Remove-DbaLogin
[-SqlCredential <PSCredential>]
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remove-DbaLogin -SqlInstance <DbaInstanceParameter[]>
[-SqlCredential <PSCredential>] -Login <String[]>
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remove-DbaLogin
[-SqlCredential <PSCredential>] -InputObject <Login[]>
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Remove-DbaLogin -SqlInstance sql2016 -Login mylogin
Prompts then removes the Login mylogin on SQL Server sql2016
PS C:\> Remove-DbaLogin -SqlInstance sql2016 -Login mylogin, yourlogin
Prompts then removes the Logins mylogin and yourlogin on SQL Server sql2016
PS C:\> Remove-DbaLogin -SqlInstance sql2016 -Login mylogin -Confirm:$false
Does not prompt and swiftly removes mylogin on SQL Server sql2016
PS C:\> Get-DbaLogin -SqlInstance server\instance -Login yourlogin | Remove-DbaLogin
Removes mylogin on SQL Server server\instance
The target SQL Server instance or instances.
Alias | |
Required | True |
Pipeline | false |
Default Value |
The Login(s) to process - this list is auto-populated from the server. If unspecified, all Logins will be processed.
Alias | |
Required | True |
Pipeline | false |
Default Value |
A collection of Logins (such as returned by Get-DbaLogin), to be removed.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Allows you to login to servers using alternative credentials.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Kills any sessions associated with the login prior to drop
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Shows what would happen if the command were to run. No actions are actually performed.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts you for confirmation before executing any changing operations within the command.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |