Closed kevinmccurdybrd closed 2 months ago
Hi, appreciate your feedback! I hope it's not a silly question, but how many PMPC apps and updates do you have in Intune, and do you have assignments on them?
Hey Trevor,
Thanks for the quick response. I've got a dozens of apps assigned, however I probably only have one update assigned (it was zero, but I figured that might be causing this problem, so I assigned one to a test group to ensure there was data) Do I need to do a couple more?
Cheers,
Ok, if you've got PMPC apps assigned that's good. We'll need to step through the process to see where it's breaking down for you.
Can you create a new runbook with the following code and execute it? It should output the number of PMPC apps it is returning from MS Graph. eg "PMPC apps count: 259"
`$ProgressPreference = 'SilentlyContinue'
$url = $env:IDENTITY_ENDPOINT
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("X-IDENTITY-HEADER", $env:IDENTITY_HEADER)
$headers.Add("Metadata", "True")
$body = @{resource='https://graph.microsoft.com/' }
$script:accessToken = (Invoke-RestMethod $url -Method 'POST' -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body $body ).access_token
$URL = "https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps?`$filter=startswith(notes, 'Pmp')&$expand=assignments&
$select=id,displayName,description,publisher,createdDateTime,lastModifiedDateTime,notes"
$headers = @{'Authorization'="Bearer " + $accessToken}
$Result = [System.Collections.ArrayList]::new()
$GraphRequest = Invoke-WebRequest -Uri $URL -Headers $headers -Method Get -UseBasicParsing
If ($GraphRequest.StatusCode -ne 200)
{
Return $GraphRequest
}
$Content = $GraphRequest.Content | ConvertFrom-Json
[void]$Result.Add($Content.value)
Write-Output "PMPC apps count: $($Result.Count)"`
I'm not sure if I copied something incorrectly or I misunderstood the assignment but the job fails and when I run it in test pane I get:
There are backticks (`) at the beginning and end of the code - you should remove these. GitHub markup doesn't display code sections properly if your code includes backticks, which this does 🙄
D'oh. Sorry about that.
PMPC apps count: 1
I have significantly more apps via PMPC than that.
Ok, interesting. Can you please change the second to last line with the following and re-run?
[void]$Result.AddRange($Content.value)
PMPC apps count: 597
That's more like it! I guess there are some differences between how different runtimes interpret the code. I've updated the runbook - can you try the new version?
So far so good, still running
With the number of apps you have, you can expect it to take some time. There's a lot of data it has to export and it will have to negotiate some 429s due to Graph service limits.
NO worries, it's clearly doing more now, old runtime was like 10 seconds. Keep at this man, you're doing great work. Are you planning separate reporting for patchmypc custom apps?
I hadn't even thought about custom apps actually... I'll make a note to get those added in. Thanks for the suggestion!
No, thank you for the rapid help! I'll let you know if I find anything else!
Hey!
Thanks for all the work you've done here these are fantastic reports. I've got the Update and Assignments dashboards working, but I'm having issues with the PMPC one. I'm seeing errors in the AA runbook log:
When I check the SA, the container has files, but they're all basically 0 output, particularily the apps list and .
I'm using a managed identity, perms are right based on the docs, I think:
I'm probably missing something super basic, but could you help me figure this out? Really appreciate your work here.
I did revert one version of the script, your sortable change was also throwing errors for me so I just wanted to eliminate one possibility.
Exception calling "Select" with "1" argument(s): "Cannot find column [notes]." At line:259 char:5 + [array]$script:PmpApps = $DataTable.Select("notes LIKE 'PmpAppId: ... +
~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : EvaluateException