Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Private/Test-IntuneWin32AppAssignment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ function Test-IntuneWin32AppAssignment {
[ValidateNotNullOrEmpty()]
[string]$ID,

[parameter(Mandatory = $false, HelpMessage = "Specify the DataType in this assignment")]
[ValidateNotNullOrEmpty()]
[string]$DataType,

[parameter(Mandatory = $false, HelpMessage = "Specify the target type of the assignment, AllDevices, AllUsers or Group.")]
[ValidateNotNullOrEmpty()]
[ValidateSet("AllDevices", "AllUsers", "Group")]
Expand Down Expand Up @@ -57,7 +61,7 @@ function Test-IntuneWin32AppAssignment {
switch ($Target) {
"Group" {
foreach ($Win32AppAssignment in $Win32AppAssignments.value) {
if ($Win32AppAssignment.target.'@odata.type' -match "groupAssignmentTarget") {
if ($Win32AppAssignment.target.'@odata.type' -eq $DataType) {
if ($Win32AppAssignment.target.groupId -like $GroupID) {
Write-Warning -Message "Win32 app assignment with id '$($Win32AppAssignment.id)' of target type '$($Target)' and GroupID '$($Win32AppAssignment.target.groupId)' already exists, duplicate assignments of this type is not permitted"
$DuplicateAssignmentDetected = $true
Expand Down
2 changes: 1 addition & 1 deletion Public/Add-IntuneWin32AppAssignmentGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function Add-IntuneWin32AppAssignmentGroup {
}
}

$DuplicateAssignment = Test-IntuneWin32AppAssignment -ID $Win32AppID -Target "Group"
$DuplicateAssignment = Test-IntuneWin32AppAssignment -ID $Win32AppID -Target "Group" -DataType $DataType
if ($DuplicateAssignment -eq $false) {
try {
# Attempt to call Graph and create new assignment for Win32 app
Expand Down