Skip to main content
Version: 3.0.0-preview

Set-MtConnectionState

SYNOPSIS​

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

SYNTAX​

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

DESCRIPTION​

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.

EXAMPLES​

EXAMPLE 1​

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.

PARAMETERS​

-Value​

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

-Account​

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

-Tenant​

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

-Service​

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

-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​

NOTES​

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