From 3e19048bdefb634a308ff7e563181bdc5a4235a6 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Fri, 6 Sep 2024 17:35:12 +0200 Subject: [PATCH] UserGroup: Fix when no members --- PowerFGT/Public/cmdb/user/group.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PowerFGT/Public/cmdb/user/group.ps1 b/PowerFGT/Public/cmdb/user/group.ps1 index 144b974aa..27d36970f 100644 --- a/PowerFGT/Public/cmdb/user/group.ps1 +++ b/PowerFGT/Public/cmdb/user/group.ps1 @@ -543,10 +543,10 @@ function Remove-FGTUserGroupMember { $members = $members | Where-Object { $_.name -ne $remove_member } } - #check if there is always a member... (it is not possible don't have member on User Group) - #if ( $members.count -eq 0 ) { - # Throw "You can't remove all members. Use Remove-FGTUserGroup to remove User Group" - #} + #check if there is always a member... (and force array) + if ( $members.count -eq 0 ) { + $members = @() + } #if there is only One member force to be an array if ( $members.count -eq 1 ) {