Skip to content
Sponsor
3.0 preview2.3.0 stable

These docs describe the preview. Pick the version you run and every page marks what it doesn't have yet. Get the preview →
Maester 2.x docs (archived) →

Set-MtConnectionState

Keeps the connection of a Maester Pack connector for the session, so its tests and Connect-Maester can find it.

Set-MtConnectionState [-Value] <Object> [-Account <String>] [-Tenant <String>] [-Service <String>]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

A pack connector calls this from its Connect function (Maester Packs design, section 6.1). The state is kept by Maester, per service, in the PowerShell session only: it is never written to disk or to the report. The tests of the pack read it back with Get-MtConnectionState, and Disconnect-Maester clears it.

The service is the connector’s own: the one whose Connect function is running, or the only connector of the calling pack. A pack can set the state of its own services only; called from outside a pack, -Service is required.

Put an access token’s expiry in the value as ExpiresOn (a date) to have Maester call the connector’s Renew function shortly before it expires.

Set-MtConnectionState -Value @{ Token = $token; ExpiresOn = $expiresOn } -Account $user -Tenant $domain

Inside a pack connector’s Connect function: keeps the token for the pack’s tests.

What the pack needs to reach the service: a token, a client object or settings. Kept as it is.

Type: Object
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The account or identity that is connected, shown by Get-MtTenantContext and in the report header.

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The tenant, organisation or workspace that is connected, shown with the account.

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The connector’s service name, such as CNT.GoogleWorkspace. Needed only outside the connector’s own Connect function when the pack has more than one connector.

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

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

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

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

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

https://maester.dev/docs/commands/Set-MtConnectionState