question

TorT-7951 avatar image
0 Votes"
TorT-7951 asked IssacFranklinDavid-7672 commented

Azure automation - powershell - Get-UnifiedGroup sort ordering....

Hi,

The code below lists Microsoft 365 groups and their members. I tried to pipe the result set both for the groups and for the members using the Sort-Order parameter, but it did not result in any sorting. How can I get the groups and members sorted in this code?


Declare Variable for 365 groups


 $365Groups = Get-UnifiedGroup -Identity $global:groupfilter | Sort-Object DisplayName
 # Check if the group is existing 
 If ($365Groups) {
     Foreach ($object in $365Groups) {  # Loop to list all group names with member count only
         $Group = Get-UnifiedGroupLinks -Identity "$object" -Linktype member | Sort-Object DisplayName
          $FinalGCount = "(" + $Group.count + ")"
          WriteLine $object, $FinalGCount                                        
     }

Thanks a lot for comments :-)

azure-automation
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@TorT-7951 Have you tried to execute the script in local machine PowerShell Console? Were you facing the same issue ?

0 Votes 0 ·

@TorT-7951 Are you still facing the issue ? Kindly revert if you need further assistance.

0 Votes 0 ·

@SwathiDhanwada-MSFT

I am facing trouble in the similar script that I am running on my device, can you help me ?


Error : The term 'Get-UnifiedGroup' is not recognized as the name of a cmdlet, function, script file, or operable program

0 Votes 0 ·

0 Answers