@@ -38,6 +38,11 @@ Function Invoke-ListIntunePolicy {
3838 method = ' GET'
3939 url = " /deviceManagement/windowsDriverUpdateProfiles?`$ expand=assignments&top=200"
4040 }
41+ @ {
42+ id = ' WindowsFeatureUpdateProfiles'
43+ method = ' GET'
44+ url = " /deviceManagement/windowsFeatureUpdateProfiles?`$ expand=assignments&top=200"
45+ }
4146 @ {
4247 id = ' GroupPolicyConfigurations'
4348 method = ' GET'
@@ -58,48 +63,49 @@ Function Invoke-ListIntunePolicy {
5863 $BulkResults = New-GraphBulkRequest - Requests $BulkRequests - tenantid $TenantFilter
5964
6065 $GraphRequest = $BulkResults | ForEach-Object {
61- $URLName = $_.Id
62- $_.body.Value | ForEach-Object {
63- $policyTypeName = switch - Wildcard (
$_ .
' [email protected] ' ) {
64- ' *microsoft.graph.windowsIdentityProtectionConfiguration*' { ' Identity Protection' }
65- ' *microsoft.graph.windows10EndpointProtectionConfiguration*' { ' Endpoint Protection' }
66- ' *microsoft.graph.windows10CustomConfiguration*' { ' Custom' }
67- ' *microsoft.graph.windows10DeviceFirmwareConfigurationInterface*' { ' Firmware Configuration' }
68- ' *groupPolicyConfigurations*' { ' Administrative Templates' }
69- ' *windowsDomainJoinConfiguration*' { ' Domain Join configuration' }
70- ' *windowsUpdateForBusinessConfiguration*' { ' Update Configuration' }
71- ' *windowsHealthMonitoringConfiguration*' { ' Health Monitoring' }
72- ' *microsoft.graph.macOSGeneralDeviceConfiguration*' { ' MacOS Configuration' }
73- ' *microsoft.graph.macOSEndpointProtectionConfiguration*' { ' MacOS Endpoint Protection' }
74- ' *microsoft.graph.androidWorkProfileGeneralDeviceConfiguration*' { ' Android Configuration' }
75- default { $_ . ' [email protected] ' }
76- }
77- $Assignments = $_ .assignments.target | Select-Object - Property ' @odata.type ' , groupId
78- $PolicyAssignment = [ System.Collections.Generic.List [ string ]]::new()
79- $PolicyExclude = [System.Collections.Generic.List [string ]]::new()
80- ForEach ( $target in $Assignments ) {
81- switch ($target . ' @odata.type ' ) {
82- ' #microsoft.graph.allDevicesAssignmentTarget ' { $PolicyAssignment .Add ( ' All Devices ' ) }
83- ' #microsoft.graph.exclusionallDevicesAssignmentTarget ' { $PolicyExclude .Add (' All Devices' ) }
84- ' #microsoft.graph.allUsersAssignmentTarget ' { $PolicyAssignment .Add (' All Users ' ) }
85- ' #microsoft.graph.allLicensedUsersAssignmentTarget ' { $PolicyAssignment.Add (' All Licenced Users' ) }
86- ' #microsoft.graph.exclusionallUsersAssignmentTarget ' { $PolicyExclude .Add (' All Users' ) }
87- ' #microsoft.graph.groupAssignmentTarget ' { $PolicyAssignment .Add ($Groups .Where ({ $_ .id -eq $target .groupId }).displayName ) }
88- ' #microsoft.graph.exclusionGroupAssignmentTarget ' { $PolicyExclude .Add ($Groups.Where ({ $_.id -eq $target.groupId }).displayName) }
89- default {
90- $PolicyAssignment .Add ( $null )
91- $PolicyExclude .Add ($null )
92- }
66+ $URLName = $_.Id
67+ $_.body.Value | ForEach-Object {
68+ $policyTypeName = switch - Wildcard (
$_ .
' [email protected] ' ) {
69+ ' *microsoft.graph.windowsIdentityProtectionConfiguration*' { ' Identity Protection' }
70+ ' *microsoft.graph.windows10EndpointProtectionConfiguration*' { ' Endpoint Protection' }
71+ ' *microsoft.graph.windows10CustomConfiguration*' { ' Custom' }
72+ ' *microsoft.graph.windows10DeviceFirmwareConfigurationInterface*' { ' Firmware Configuration' }
73+ ' *groupPolicyConfigurations*' { ' Administrative Templates' }
74+ ' *windowsDomainJoinConfiguration*' { ' Domain Join configuration' }
75+ ' *windowsUpdateForBusinessConfiguration*' { ' Update Configuration' }
76+ ' *windowsHealthMonitoringConfiguration*' { ' Health Monitoring' }
77+ ' *microsoft.graph.macOSGeneralDeviceConfiguration*' { ' MacOS Configuration' }
78+ ' *microsoft.graph.macOSEndpointProtectionConfiguration*' { ' MacOS Endpoint Protection' }
79+ ' *microsoft.graph.androidWorkProfileGeneralDeviceConfiguration*' { ' Android Configuration' }
80+ ' *windowsFeatureUpdateProfiles* ' { ' Feature Update ' }
81+ default { $_ . ' [email protected] ' }
82+ }
83+ $Assignments = $_ .assignments.target | Select-Object - Property ' @odata.type ' , groupId
84+ $PolicyAssignment = [System.Collections.Generic.List [string ]]::new()
85+ $PolicyExclude = [ System.Collections.Generic.List [ string ]]::new()
86+ ForEach ($target in $Assignments ) {
87+ switch ( $target . ' @odata.type ' ) {
88+ ' #microsoft.graph.allDevicesAssignmentTarget ' { $PolicyAssignment .Add (' All Devices' ) }
89+ ' #microsoft.graph.exclusionallDevicesAssignmentTarget ' { $PolicyExclude .Add (' All Devices ' ) }
90+ ' #microsoft.graph.allUsersAssignmentTarget ' { $PolicyAssignment.Add (' All Users' ) }
91+ ' #microsoft.graph.allLicensedUsersAssignmentTarget ' { $PolicyAssignment .Add (' All Licenced Users' ) }
92+ ' #microsoft.graph.exclusionallUsersAssignmentTarget ' { $PolicyExclude .Add (' All Users ' ) }
93+ ' #microsoft.graph.groupAssignmentTarget ' { $PolicyAssignment .Add ($Groups.Where ({ $_.id -eq $target.groupId }).displayName) }
94+ ' #microsoft.graph.exclusionGroupAssignmentTarget ' { $PolicyExclude .Add ( $Groups .Where ({ $_ .id -eq $target .groupId }).displayName) }
95+ default {
96+ $PolicyAssignment .Add ($null )
97+ $PolicyExclude .Add ( $null )
9398 }
9499 }
95- if ($null -eq $_.displayname ) { $_ | Add-Member - NotePropertyName displayName - NotePropertyValue $_.name }
96- $_ | Add-Member - NotePropertyName PolicyTypeName - NotePropertyValue $policyTypeName
97- $_ | Add-Member - NotePropertyName URLName - NotePropertyValue $URLName
98- $_ | Add-Member - NotePropertyName PolicyAssignment - NotePropertyValue ($PolicyAssignment -join ' , ' )
99- $_ | Add-Member - NotePropertyName PolicyExclude - NotePropertyValue ($PolicyExclude -join ' , ' )
100- $_
101- } | Where-Object { $null -ne $_.DisplayName }
102- }
100+ }
101+ if ($null -eq $_.displayname ) { $_ | Add-Member - NotePropertyName displayName - NotePropertyValue $_.name }
102+ $_ | Add-Member - NotePropertyName PolicyTypeName - NotePropertyValue $policyTypeName
103+ $_ | Add-Member - NotePropertyName URLName - NotePropertyValue $URLName
104+ $_ | Add-Member - NotePropertyName PolicyAssignment - NotePropertyValue ($PolicyAssignment -join ' , ' )
105+ $_ | Add-Member - NotePropertyName PolicyExclude - NotePropertyValue ($PolicyExclude -join ' , ' )
106+ $_
107+ } | Where-Object { $null -ne $_.DisplayName }
108+ }
103109 }
104110
105111 # Filter the results to sort out linux scripts
0 commit comments