document type: cmdlet external help file: IntuneScriptLab-Help.xml HelpUri: https://github.com/fadwen/IntuneScriptLab/blob/main/docs/IntuneScriptLab/Assert-HaveIntuneStatus.md Locale: en-US Module Name: IntuneScriptLab ms.date: 09/28/2026 PlatyPS schema version: 2024-05-01 title: Assert-HaveIntuneStatus
Asserts a remediation or Win32 result Status (alias Should-HaveIntuneStatus).
Assert-HaveIntuneStatus [-Expected] <string> [[-Actual] <Object>] [-Because <string>]
[<CommonParameters>]
For IntuneScriptLab.RemediationResult ('Without issues', 'Issue detected (no remediation script)', 'Fixed', 'Recurred', 'Failed', 'TimedOut') and IntuneScriptLab.Win32AppResult ('Installed', 'Installed after install', 'Not detected after install', 'Install failed (exit N)', 'Retry', 'Not installed', 'Not installed (dependency)', 'Uninstalled', 'Still detected after uninstall', 'Uninstall failed (exit N)', 'TimedOut'). On failure the message carries what Intune would have shown: the actual status, the reported output and error, and the harness warnings.
Invoke-IntuneRemediationTest -DetectionPath .\Detect.ps1 -RemediationPath .\Remediate.ps1 | Should-HaveIntuneStatus 'Fixed'
The full flow must end Fixed.
$result | Should-HaveIntuneStatus 'Without issues' -Because 'the baseline image is compliant'
Detection alone, with the reason in the failure message.
Invoke-IntuneWin32AppTest -DetectionPath .\Detect-App.ps1 -ContentPath .\Package ` -InstallCommand 'setup.exe /S' | Should-HaveIntuneStatus 'Installed after install'
A Win32 package that must install and then be detected.
The result object, usually piped from Invoke-IntuneRemediationTest or Invoke-IntuneWin32AppTest.
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Why the status matters; quoted in the failure message.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''The status the portal should show.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''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.
From Invoke-IntuneRemediationTest; Status is compared with Expected.
From Invoke-IntuneWin32AppTest; Status is compared with Expected.
The result object piped into the assertion. New-ShouldAssertion collects the pipeline, so the assertion also accepts the object as its positional argument.
Throws a Pester assertion failure when the status differs; the message carries IntuneOutput, IntuneError and any Warnings from the result.
Author: Jeffrey Stuhr. Every rule and verdict is backed by observations recorded in Validation\Findings.md (documented vs observed Intune behaviour).