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.
To return all active directory groups with logins on Sql Instance DEV01 that contain the AD user Stephen.Bennett.
Find-DbaLoginInGroup -SqlInstance DEV01 -Login ad\Stephen.Bennett
To return all active directory users within all windows AD groups that have logins on the instance.
Find-DbaLoginInGroup -SqlInstance DEV01
To return all active directory users within all windows AD groups that have logins on the instance whose login contains ‘stephen’
Find-DbaLoginInGroup -SqlInstance DEV01 | Where-Object Login -like stephen
This command was created by Stephen Bennett. You can find Stephen blogging at sqlnotesfromtheunderground.wordpress.com.