@@ -349,21 +349,37 @@ function Get-GraphRequestList {
349349 $Property = $BatchExpandQuery -replace ' \?.*$' , ' ' -replace ' ^.*\/' , ' '
350350 Write-Information " Performing batch expansion for property '$Property '..."
351351
352- $Uri = " $Endpoint /{0}/$BatchExpandQuery "
352+ if ($Property -eq ' assignedLicenses' ) {
353+ $LicenseDetails = Get-CIPPLicenseOverview - TenantFilter $TenantFilter
354+ $GraphRequestResults = foreach ($GraphRequestResult in $GraphRequestResults ) {
355+ $NewLicenses = [system.collections.generic.list [string ]]::new()
356+ foreach ($License in $GraphRequestResult.assignedLicenses ) {
357+ $LicenseInfo = $LicenseDetails | Where-Object { $_.skuId -eq $License.skuId } | Select-Object - First 1
358+ if ($LicenseInfo ) {
359+ $NewLicenses.Add ($LicenseInfo.License )
360+ }
361+ }
362+ $GraphRequestResult | Add-Member - MemberType NoteProperty - Name $Property - Value @ ($NewLicenses ) - Force
363+ $GraphRequestResult
364+ }
365+ } else {
366+
367+ $Uri = " $Endpoint /{0}/$BatchExpandQuery "
353368
354- $Requests = foreach ($Result in $GraphRequestResults ) {
355- @ {
356- id = $Result.id
357- url = $Uri -f $Result.id
358- method = ' GET'
369+ $Requests = foreach ($Result in $GraphRequestResults ) {
370+ @ {
371+ id = $Result.id
372+ url = $Uri -f $Result.id
373+ method = ' GET'
374+ }
359375 }
360- }
361- $BatchResults = New-GraphBulkRequest - Requests @ ($Requests ) - tenantid $TenantFilter - NoAuthCheck $NoAuthCheck.IsPresent - asapp $AsApp
376+ $BatchResults = New-GraphBulkRequest - Requests @ ($Requests ) - tenantid $TenantFilter - NoAuthCheck $NoAuthCheck.IsPresent - asapp $AsApp
362377
363- $GraphRequestResults = foreach ($Result in $GraphRequestResults ) {
364- $PropValue = $BatchResults | Where-Object { $_.id -eq $Result.id } | Select-Object - ExpandProperty body
365- $Result | Add-Member - MemberType NoteProperty - Name $Property - Value ($PropValue.value ?? $PropValue )
366- $Result
378+ $GraphRequestResults = foreach ($Result in $GraphRequestResults ) {
379+ $PropValue = $BatchResults | Where-Object { $_.id -eq $Result.id } | Select-Object - ExpandProperty body
380+ $Result | Add-Member - MemberType NoteProperty - Name $Property - Value ($PropValue.value ?? $PropValue )
381+ $Result
382+ }
367383 }
368384 }
369385 }
0 commit comments