Invoke-MtTest
Synopsis
Section titled “Synopsis”Runs one or more Maester native tests through the engine and returns their result rows.
Syntax
Section titled “Syntax”Invoke-MtTest [[-Id] <String[]>] [-Path <String>] [-Parameter <Hashtable>] [-Config <Object>] [-ProgressAction <ActionPreference>] [<CommonParameters>]Description
Section titled “Description”Runs built-in tests by ID, or the native tests (Test.<ID>.ps1) in a file or folder, with the same applicability gates, parameter binding and result rows as Invoke-Maester, but without reports.
This is how a custom test reuses a built-in check (instead of calling its function directly), and how a test author runs the test they are writing.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”Invoke-MtTest -Id MT.1005Runs the built-in test MT.1005 and returns its result row.
Example 2
Section titled “Example 2”Invoke-MtTest -Path ./custom/Test.CONTOSO.1001.ps1 -Parameter @{ MaximumDays = 30 }Runs a custom test with a parameter value, as while writing it.
Example 3
Section titled “Example 3”Invoke-MtTest -Path ./my-packRuns every test of a Maester Pack from its folder, as while writing the pack.
Parameters
Section titled “Parameters”Test IDs to run: exact IDs or ’*’ wildcards. A family’s instance ID runs that instance.
Type: String[]Parameter Sets: (All)Aliases:
Required: FalsePosition: 1Default value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseA Test.<ID>.ps1 file or a folder of them. Without -Id every native test in it runs. A path inside a Maester Pack (a folder with maester-pack.json, or under one) runs as that pack, with its helpers and connectors, as while writing the pack.
Type: StringParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Parameter
Section titled “-Parameter”Parameter values for the test. Allowed only when exactly one test is selected.
Type: HashtableParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Config
Section titled “-Config”The run configuration: a path, an object or an array of them, as for Invoke-Maester. Defaults to the configuration of the current Invoke-Maester run, else the config files found from -Path or the current folder.
Type: ObjectParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-ProgressAction
Section titled “-ProgressAction”Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.
Type: ActionPreferenceParameter Sets: (All)Aliases: proga
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseCommonParameters
Section titled “CommonParameters”This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.