Skip to content

Commit 1e309cb

Browse files
committed
handle objects that do not have group type
1 parent 5d27fd0 commit 1e309cb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecTenantGroup.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ function Invoke-ExecTenantGroup {
3535
if ($groupDescription) {
3636
$GroupEntity.Description = $groupDescription
3737
}
38-
$GroupEntity.GroupType = $groupType
38+
if (!$GroupEntity.PSObject.Properties.Name -contains 'GroupType') {
39+
$GroupEntity | Add-Member -NotePropertyName 'GroupType' -NotePropertyValue $groupType -Force
40+
} else {
41+
$GroupEntity.GroupType = $groupType
42+
}
3943
if ($groupType -eq 'dynamic' -and $dynamicRules) {
40-
$GroupEntity.DynamicRules = "$($dynamicRules | ConvertTo-Json -depth 100 -Compress)"
44+
$GroupEntity.DynamicRules = "$($dynamicRules | ConvertTo-Json -Depth 100 -Compress)"
4145
$GroupEntity | Add-Member -NotePropertyName 'RuleLogic' -NotePropertyValue $ruleLogic -Force
4246
} else {
4347
$GroupEntity | Add-Member -NotePropertyName 'RuleLogic' -NotePropertyValue $null -Force
@@ -52,7 +56,7 @@ function Invoke-ExecTenantGroup {
5256
GroupType = $groupType
5357
}
5458
if ($groupType -eq 'dynamic' -and $dynamicRules) {
55-
$GroupEntity.DynamicRules = "$($dynamicRules | ConvertTo-Json -depth 100 -Compress)"
59+
$GroupEntity.DynamicRules = "$($dynamicRules | ConvertTo-Json -Depth 100 -Compress)"
5660
$GroupEntity.RuleLogic = $ruleLogic
5761
}
5862
Add-CIPPAzDataTableEntity @Table -Entity $GroupEntity -Force

0 commit comments

Comments
 (0)