document type: cmdlet external help file: IntuneScriptLab-Help.xml HelpUri: https://github.com/fadwen/IntuneScriptLab/blob/main/docs/IntuneScriptLab/Assert-BeIntuneDetected.md Locale: en-US Module Name: IntuneScriptLab ms.date: 09/28/2026 PlatyPS schema version: 2024-05-01 title: Assert-BeIntuneDetected
Asserts a Win32 detection result counts as installed (alias Should-BeIntuneDetected).
Assert-BeIntuneDetected [[-Actual] <Object>] [-Because <string>] [<CommonParameters>]
Passes when Invoke-IntuneDetectionTest reported Detected. On failure the message carries the reason Intune would give: the exit code, missing stdout, or output on stderr.
Invoke-IntuneDetectionTest -Path .\Detect-App.ps1 | Should-BeIntuneDetected
The app must be detected on this machine.
Invoke-IntuneDetectionTest -Path .\Detect-App.ps1 -Architecture x86 | Should-BeIntuneDetected -Because 'the rule is set to run as 32-bit'
Same, in the 32-bit host, with the reason in the failure message.
$result | Should-NotBeIntuneDetected
The opposite check, for a machine where the app is absent.
The IntuneScriptLab.DetectionResult, usually piped.
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: false
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Why detection 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: ''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-IntuneDetectionTest; Detected must be true.
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 app is not detected; the message carries the Reason.
Author: Jeffrey Stuhr. Every rule and verdict is backed by observations recorded in Validation\Findings.md (documented vs observed Intune behaviour).