Skip to content

Get-IntuneRemediationDeviceStatus

SYNOPSIS

Retrieves per-device run state and pre/post remediation output for a specific Intune proactive remediation.

SYNTAX

ByName (Default)

Get-IntuneRemediationDeviceStatus -Name <string> [-ConvertPreRemediationOutput]
 [-ConvertPostRemediationOutput] [<CommonParameters>]

ById

Get-IntuneRemediationDeviceStatus -Id <string> [-ConvertPreRemediationOutput]
 [-ConvertPostRemediationOutput] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

Queries Microsoft Graph (beta) for the device run states of a proactive remediation script (device health script). Returns one row per device, including the detection and remediation states and the captured pre/post-remediation detection script output.

Requires an authenticated Graph session with appropriate scopes.

Scopes (minimum): - DeviceManagementConfiguration.Read.All

EXAMPLES

EXAMPLE 1

Connect-MgGraph -Scopes "DeviceManagementConfiguration.Read.All" Get-IntuneRemediationDeviceStatus -Name "BitLocker*"

Returns per-device run states for all remediations whose name starts with "BitLocker".

EXAMPLE 2

Get-IntuneRemediationDeviceStatus -Id "f1f5d1d7-2d2b-4d8c-9f0a-0d2a3d1e2f3a"

Returns per-device run states for the remediation with the specified ID.

EXAMPLE 3

Get-IntuneRemediationSummary | Where-Object WithIssues -gt 0 | Get-IntuneRemediationDeviceStatus

Pipes remediations that have devices with issues into this cmdlet to get device-level detail.

EXAMPLE 4

Get-IntuneRemediationDeviceStatus -Name 'Win | Device | All | Detection | Secure Boot Status' -ConvertPreRemediationOutput | Where-Object { $null -ne $_.PreRemediationData }

Parses valid JSON found in PreRemediationOutput and exposes it as PreRemediationData.

EXAMPLE 5

Get-IntuneRemediationDeviceStatus -Name 'Win | Device | All | Detection | Secure Boot Status' -ConvertPreRemediationOutput -ConvertPostRemediationOutput | Select-Object DeviceName, DetectionState, RemediationState, PreRemediationData, PostRemediationData

Parses valid JSON from both remediation output fields and selects the parsed data alongside device state.

PARAMETERS

-ConvertPostRemediationOutput

Parses PostRemediationOutput as JSON and adds a PostRemediationData property when valid JSON is present.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ConvertPreRemediationOutput

Parses PreRemediationOutput as JSON and adds a PreRemediationData property when valid JSON is present.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Id

The ID (GUID) of the device health script (remediation) to query. Parameter set: ById.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- RemediationId
ParameterSets:
- Name: ById
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Name

The display name of the remediation script. Supports wildcards (*). When multiple scripts match, all are processed. Parameter set: ByName.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- RemediationName
ParameterSets:
- Name: ByName
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String (Name or Id via pipeline by property name)

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

OUTPUTS

PSCustomObject with the following properties

  • RemediationName (string) : Display name of the remediation script
  • RemediationId (string) : GUID of the device health script
  • DeviceId (string) : Managed device ID
  • DeviceName (string) : Managed device display name
  • UserPrincipalName (string) : Primary user UPN of the device
  • LastStateUpdate (datetime / null): When the run state was last updated
  • DetectionState (string) : Outcome of the last detection script run
  • RemediationState (string) : Outcome of the last remediation script run
  • PreRemediationOutput (string) : stdout captured before remediation ran
  • PostRemediationOutput (string) : stdout captured after remediation ran
  • PreRemediationData (object/null) : Parsed JSON from PreRemediationOutput when -ConvertPreRemediationOutput is used
  • PostRemediationData (object/null): Parsed JSON from PostRemediationOutput when -ConvertPostRemediationOutput is used
  • DetectionOutput (string) : Detection-only script stdout
  • PreRemediationError (string) : stderr captured before remediation ran
  • RemediationError (string) : stderr from the remediation script
  • DetectionError (string) : stderr from the detection script

{{ Fill in the Description }}

System.Management.Automation.PSObject

{{ Fill in the Description }}

NOTES

Author: FHN & GitHub Copilot - Uses /beta Graph endpoints. - Expands managedDevice to include DeviceName and UserPrincipalName inline.

{{ Fill in the related links here }}