Querying members of an AD group with a huge number of users might be tricky.
1. Method for smaller groups
The easiest way of getting the members of a certain Active Directory group is by using the Get-ADGroupMember cmdlet as the following examples shows:
Get-ADGroupMember "VeryLargeGroup"
However if the number of members is exceeding 5000, sadly the command fails.

2. Method for large AD groups (over 5000 members)
If you need to query the members of bigger groups an easy workaround is querying the member property of the Get-ADGroup cmdlet. This time we try to get the member users of universal AD security group VeryLargeGroup:
I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
(Get-ADGroup "VeryLargeGroup" -Properties member).member
This returns all the members in an array, but by their distinguished names.

Here we need the names and SamAccountNames of the users so we amend the query a little bit
$members = (Get-ADGroup "VeryLargeGroup" -Properties member).member $members | Foreach-Object {Get-ADUser $_} | Select name, samaccountname

properties – no longer available
The Properties parameter should be available for that cmdlet. Ref: https://docs.microsoft.com/en-us/powershell/module/activedirectory/get-adgroup?view=windowsserver2022-ps
Can you confirm which Windows Server version are you using?
how i use the – recursive in this comment ??