MSEndpointMgr / IntuneWin32App

Provides a set of functions to manage all aspects of Win32 apps in Microsoft Intune.
MIT License
351 stars 91 forks source link

Get-IntuneWin32AppAssignment returning Excluded value for Property GroupMode for 'All Users' and 'All Devices' #153

Open Skeb1ns opened 7 months ago

Skeb1ns commented 7 months ago

The Get-IntuneWin32AppAssignment cmdlet is currently returning the Excluded value for Property GroupMode for 'All Users' and 'All Devices' even if these groups are Included in the assignment scope.

I looked into the cmdlet and I think this behavior occurs because starting on line 187 the $GroupMode variable is declared, the last value Exclude is assigned, the odata.type #microsoft.graph.allDevicesAssignmentTarget is not handled in the switch and the value Exclude is retained and returned in the PSObject.

switch ($Win32AppAssignment.target.'@odata.type') {
                                    "#microsoft.graph.groupAssignmentTarget" {
                                        $GroupMode = "Include"
                                    }
                                    "#microsoft.graph.exclusionGroupAssignmentTarget" {
                                        $GroupMode = "Exclude"
                                    }
                                }
Skeb1ns commented 7 months ago

Added https://github.com/MSEndpointMgr/IntuneWin32App/pull/154 as a suggested fix.