Author | Stephen Bennett, sqlnotesfromtheunderground.wordpress.com , Simone Bizzotto (@niphlod) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Find-DbaLoginInGroup on GitHub.
Want to see the Bill Of Health for this command? Check out Find-DbaLoginInGroup.
Finds Logins in Active Directory groups that have logins on the SQL Instance.
Outputs all the active directory groups members for a server, or limits it to find a specific AD user in the groups
Find-DbaLoginInGroup
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-Login] <String[]>]
[-EnableException]
[<CommonParameters>]
PS C:\> Find-DbaLoginInGroup -SqlInstance DEV01 -Login "MyDomain\Stephen.Bennett"
Returns all active directory groups with logins on Sql Instance DEV01 that contain the AD user Stephen.Bennett.
PS C:\> Find-DbaLoginInGroup -SqlInstance DEV01
Returns all active directory users within all windows AD groups that have logins on the instance.
PS C:\> Find-DbaLoginInGroup -SqlInstance DEV01 | Where-Object Login -like '*stephen*'
Returns all active directory users within all windows AD groups that have logins on the instance whose login contains "stephen"
The target SQL Server instance or instances. This can be a collection and receive pipeline input.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
PSCredential object to connect under. If not specified, current Windows login will be used.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Find all AD Groups used on the instance that an individual login is a member of.
Alias | |
Required | False |
Pipeline | false |
Default Value |
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 |