Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds two new Intune Remediation-focused PowerShell cmdlets that query Microsoft Graph (beta) to surface proactive remediation summary metrics and per-device run state details, along with supporting helper logic and Pester test coverage.
Changes:
- Introduces
Get-IntuneRemediationSummaryto list remediations and map runSummary/history counters into a consistent summary output. - Introduces
Get-IntuneRemediationDeviceStatusto retrieve per-device run states (including pre/post detection output) for a remediation by name or id. - Adds
Get-FirstPropertyValuehelper plus Pester tests, and updates README with new examples.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/functions/public/Remediation/Get-IntuneRemediationSummary.ps1 |
New cmdlet for remediation summary statistics with history fallback and flexible payload-shape handling. |
src/functions/public/Remediation/Get-IntuneRemediationDeviceStatus.ps1 |
New cmdlet for per-device remediation run state retrieval by Name/Id. |
src/functions/private/Get-FirstPropertyValue.ps1 |
New helper to resolve values from direct properties, dictionaries, or AdditionalProperties. |
tests/public/Remediation/Get-IntuneRemediationSummary.Tests.ps1 |
Test coverage for summary mapping, missing fields defaults, payload variations, and error handling. |
tests/public/Remediation/Get-IntuneRemediationDeviceStatus.Tests.ps1 |
Test coverage for name/id parameter sets, not-found behavior, run-states error behavior, and pipeline binding. |
tests/private/Get-FirstPropertyValue.Tests.ps1 |
Test coverage for helper behavior including AdditionalProperties and valid zero values. |
README.md |
Documents the new cmdlets and adds usage/output examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+230
to
+240
| $historyNoIssue = ($historyData | ForEach-Object { | ||
| [int](Get-FirstPropertyValue -InputObject $_ -PropertyNames @('noIssueDeviceCount', 'noIssueCount', 'withoutIssues') -DefaultValue 0) | ||
| } | Measure-Object -Maximum).Maximum | ||
|
|
||
| $historyDetectFailed = ($historyData | ForEach-Object { | ||
| [int](Get-FirstPropertyValue -InputObject $_ -PropertyNames @('detectFailedDeviceCount', 'issueDetectedDeviceCount', 'issueCount', 'withIssues') -DefaultValue 0) | ||
| } | Measure-Object -Maximum).Maximum | ||
|
|
||
| $historyRemediated = ($historyData | ForEach-Object { | ||
| [int](Get-FirstPropertyValue -InputObject $_ -PropertyNames @('remediatedDeviceCount', 'issueRemediatedDeviceCount', 'issueFixedCount', 'issueFixed') -DefaultValue 0) | ||
| } | Measure-Object -Sum).Sum |
Comment on lines
+238
to
+240
| $historyRemediated = ($historyData | ForEach-Object { | ||
| [int](Get-FirstPropertyValue -InputObject $_ -PropertyNames @('remediatedDeviceCount', 'issueRemediatedDeviceCount', 'issueFixedCount', 'issueFixed') -DefaultValue 0) | ||
| } | Measure-Object -Sum).Sum |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the following cmdlets:
Get-IntuneRemediationSummary
Retrieves remediation summary statistics for all Intune proactive remediations.
Get-IntuneRemediationDeviceStatus
Retrieves per-device run state and pre/post remediation output for a specific Intune proactive remediation.