Skip to content

Commit 7df20e2

Browse files
committed
fix: fix broken assignment
* ExcludeGroupNames wrong variable * -split '\s,\s' made $AssignJSON NULL
1 parent 1d9167c commit 7df20e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/CIPPCore/Public/Set-CIPPAssignedPolicy.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function Set-CIPPAssignedPolicy {
5252
}
5353
default {
5454
Write-Host "We're supposed to assign a custom group. The group is $GroupName"
55-
$GroupNames = $GroupName -split '\s,\s'
55+
$GroupNames = $GroupName.Split(',').Trim()
5656
$GroupIds = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/groups?$select=id,displayName&$top=999' -tenantid $TenantFilter |
5757
ForEach-Object {
5858
foreach ($SingleName in $GroupNames) {
@@ -75,7 +75,7 @@ function Set-CIPPAssignedPolicy {
7575
}
7676
if ($ExcludeGroup) {
7777
Write-Host "We're supposed to exclude a custom group. The group is $ExcludeGroup"
78-
$ExcludeGroupNames = $GroupName -split '\s,\s'
78+
$ExcludeGroupNames = $ExcludeGroup.Split(',').Trim()
7979
$ExcludeGroupIds = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/groups?$select=id,displayName&$top=999' -tenantid $TenantFilter |
8080
ForEach-Object {
8181
foreach ($SingleName in $ExcludeGroupNames) {

0 commit comments

Comments
 (0)