AD Group Export with Member Count

Hi Guys 

I am learning my way through PowerShell as I can go - writing basic scripts and modifying ones I obtain to suit what I need but am currently trying to export all AD Security Groups with a member count. 

My current script extracts the basic content for the description but when I add a member count into the mix it fails sometimes errors other times just sits there indefinitely etc:

Import-Module ActiveDirectory

$FilePath = "E:\!Scripts\PowershellScripts\ActiveDirectory\SecurityGroupExport\DomainSecurityGroups_-$(get-date -format dd_MM_yy).csv"

$DomainSecurityGroup = Get-ADGroup -Filter * -Properties *

Foreach ($SecurityGroup in $DomainSecurityGroup)
{
$Group = $DomainSecurityGroup | Select-Object Name, Description, CanonicalName, GroupCategory, GroupScope, whenCreated, whenChanged |
ForEach-Object {
$Group1 = $_
$Group1.memberof |
ForEach-Object {
@{
Name = $Group1.Name
Description = $Group1.Description
OU = $Group1.CanonicalName
Category = $Group1.GroupCategory
Scope = $Group1.GroupScope
Created = $Group1.whenCreated
LastModified = $Group1.whenChanged
MemberCount = (Get-ADGroupMember $Group1 | Measure-Object).Count
}
}
}
}
$Group
$Group | Export-Csv -Path $FilePath -NoTypeInformation -Encoding UTF8

but anytime I attempt to add in member counting i always get an -identity isn't a valid parameter error - 

"Get-ADGroupMember : Cannot bind parameter 'Identity'. Cannot create object of type "Microsoft.ActiveDirectory.Management.ADGroup". The adapter cannot set the value of
property "Name".
At line:22 char:54
+ MemberCount = (Get-ADGroupMember $Group1 | Measur ...
+ ~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-ADGroupMember], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.ActiveDirectory.Management.Commands.GetADGroupMember"

I am sure I am doing something basic and stupid but as I say anytime I try to add a member count in (after multiple google examples) I still am unable to generate it as an array function, it will generate on a single group level but not when I try to use the array. 

Any help would be appreciated.