< Back
Find-DbaLoginInGroup
Post
NAME Find-DbaLoginInGroup
SYNOPSIS
Finds Logins in Active Directory groups that have logins on the SQL Instance.
SYNTAX
Find-DbaLoginInGroup [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [[-SqlCredential]
<Pscredential>] [[-Login] <System.String[]>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
Outputs all the active directory groups members for a server, or limits it to find a specific AD user in the groups
PARAMETERS
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Login [<System.String[]>]
Find all AD Groups used on the instance that an individual login is a member of.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
PSCredential object to connect under. If not specified, current Windows login will be used.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances. This can be a collection and receive pipeline input.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Login, Group, Security
Author: Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/ | Simone Bizzotto (@niphlod)
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
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.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Find-DbaLoginInGroup -SqlInstance DEV01
Returns all active directory users within all windows AD groups that have logins on the instance.
-------------------------- EXAMPLE 3 --------------------------
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"
RELATED LINKS
https://dbatools.io/Find-DbaLoginInGroup
SYNOPSIS
Finds Logins in Active Directory groups that have logins on the SQL Instance.
SYNTAX
Find-DbaLoginInGroup [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [[-SqlCredential]
<Pscredential>] [[-Login] <System.String[]>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
Outputs all the active directory groups members for a server, or limits it to find a specific AD user in the groups
PARAMETERS
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Login [<System.String[]>]
Find all AD Groups used on the instance that an individual login is a member of.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
PSCredential object to connect under. If not specified, current Windows login will be used.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances. This can be a collection and receive pipeline input.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Login, Group, Security
Author: Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/ | Simone Bizzotto (@niphlod)
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
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.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Find-DbaLoginInGroup -SqlInstance DEV01
Returns all active directory users within all windows AD groups that have logins on the instance.
-------------------------- EXAMPLE 3 --------------------------
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"
RELATED LINKS
https://dbatools.io/Find-DbaLoginInGroup