Skip to main content
Version: 3.0.0-preview

New-MtTest

SYNOPSIS​

Creates a new Maester native test: Test.<ID>.ps1 and Test.<ID>.md.

SYNTAX​

New-MtTest [-Id] <String> -Title <String> [-Severity <String>] [-Service <String[]>] [-Category <String>]
[-Path <String>] [-Force] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION​

Writes a test function with its [MaesterTest] attribute and a Markdown file with the description, remediation and result sections. Run it with Invoke-MtTest -Path, and validate it with Get-MtTest -Path.

EXAMPLES​

EXAMPLE 1​

New-MtTest -Id CONTOSO.1001 -Title 'Guest invitations are restricted' -Service Graph -Severity High

Creates Custom/Test.CONTOSO.1001.ps1 and Custom/Test.CONTOSO.1001.md.

PARAMETERS​

-Id​

The test ID. Use your own prefix, for example CONTOSO.1001.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Title​

The one-line title shown in the report.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Severity​

Critical, High, Medium, Low or Info.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Medium
Accept pipeline input: False
Accept wildcard characters: False

-Service​

The services the test needs, for example Graph or ExchangeOnline.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: @('Graph')
Accept pipeline input: False
Accept wildcard characters: False

-Category​

The report grouping. Defaults to Custom.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Custom
Accept pipeline input: False
Accept wildcard characters: False

-Path​

The folder to create the files in. Defaults to ./Custom.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: ./Custom
Accept pipeline input: False
Accept wildcard characters: False

-Force​

Overwrites existing files.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf​

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm​

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-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: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

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.

INPUTS​

OUTPUTS​

System.IO.FileInfo​

NOTES​

https://maester.dev/docs/commands/New-MtTest