Before you can use the Active Directory Cmdlets you will either need the to install the RSAT tools or run the below PowerShell on on Domain Controller. You can read more about  Active Directory Administration with Windows PowerShell here

The Script

Amend the Export-Csv path as required.

Alternative VBS Method

If you would prefer to use VBS take a look at the below link for an alternative method.

VBS Script to find all empty AD groups in the current domain