A sample script that enables you to extract a list of computer names from your custom SQL Server database and add them to an Active Directory security group. The security group can then be referenced in the Agent Assignment and Failover Wizard to automate agent assignments to Management Servers.
1. Queries customer SQL asset database.
2. Populates custom security group with computer accounts of computers returned by the SQL query.
Download from MSDN
Abstract courtesy : Microsoft
Reference :Pinal Dave (https://blog.sqlauthority.com), Text from MSDN