The script works perfectly fine except its not pulling in the domain controllers. When I dot source the gathering script and do a get-server -domaincontroller it gets them fine as well but for some reason they are not being added to the database. Has anyone figured this out and if so could you point me in the direction I am missing? I guess I should also mention that I have the correct permissions and everything for the database and I am also a domain admin.
In part 2 of the second URL that i posted he references this "There is a variable called $ServerGroup which is keeping a value of 'MemberServer'. You can disregard this (keep it uncommented though) as I have my lab set up differently where Domain Admins do not have access to anything other than domain controllers which require a second script to be used to query the domain controllers and then write the data to the SQL server (which does allow domain admins to access for the purpose of writing the data to SQL)." Maybe I am missing the second script he mentions?