ServerInventory Powershell Script from Boe Prox

First off credit goes to Boe Prox for his ServerInventory script which is located here https://github.com/proxb/ServerInventoryReport

If you want more information on the script itself that is located here https://learn-powershell.net/2017/02/27/powershell-server-inventory-part-1-sql-database-build/

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?

Thank you for any help.

Rich

If you are using just the Invoke-ServerInventoryDataGathering.ps1 script from the repo, it does not have a section to collect data for domain controllers.

If you use VS Code or PowerShell ISE, you can collapse all of the regions. That will help you isolate the cause. Line 694 has Get-Server -MemberServer (a parameter switch) which is piped into Start-RSJob. The script block starts on line 695 and ends on line 1150.

The $ServerGroup controls whether the inventory collection should retrieve local users and groups.

If you change line 694 before the pipeline to the following, it should work.

Get-Server -DomainController
Note: I looked at the history in GitHub and did not see where he had used the -DomainController switch.

Hope that helps.

Dave