Get Primary, Secondary, Tertiary DNS values and more from Multiple Servers

Came across a unique request to get primary, secondary, and tertiary DNS values for multiple computers/servers across the domain. I started writing the script and got what I wanted.

Now this started off as just to query for DNS Server information, but then I thought to add other pieces to get myself a good Network Inventory of all the servers in the environment.

I am utilizing the Win32_NetworkAdapterConfiguration WMI Class to get the required information.

You can modify the script below to suit your needs. The complete list of settings that can be captured:

Since the scripts are querying for information it is best if it runs from a DC or a privileged server with an account that has privileged access.

To get the results you need the following two scripts:


I needed to get all the network information for all the domain controllers in the domain. So the following code retrieves it for me. This came really handy in viewing all the DNS settings setup on all the DCs and correcting them if needed.


This will get the information and export to an excel file that you can have handy for reference or auditing. Hope this helps!

Find out ‘in cloud’ Distribution Groups

Microsoft Teams was announced yesterday and many want to jump right in. I noticed when users wanted to create teams, new distribution groups started getting added. I wanted to find out my ‘In cloud’ distribution groups and was surprised there was no property for the item.



I was able to find out the groups using the following:

This listed the information I needed to clean up groups.

You may also want to disable ‘group creation’ for users. Read how to do that here.


Excel: Check email addresses in bulk if format is correct or not

So had a request today to clean up email addresses as some of them were not valid. This was needed for over 1500 email addresses.

So used the formula below and was able to find all addresses that were “FALSE”. I filtered them out and was able to fix them as needed.

Here’s what you need to do:

If your e-mails are in A column, go in the B column and in the B1 cell and copy paste this code:

Then, go down and left on the B1 cell so you can copy and paste the code to the other cells.  For all the valid e-mails, it will give you ‘TRUE’ and for the invalid ‘FALSE’.