Set-MtConnectionState
Synopsis
Section titled “Synopsis”Keeps the connection of a Maester Pack connector for the session, so its tests and Connect-Maester can find it.
Syntax
Section titled “Syntax”Set-MtConnectionState [-Value] <Object> [-Account <String>] [-Tenant <String>] [-Service <String>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Section titled “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
Section titled “Examples”Example 1
Section titled “Example 1”Set-MtConnectionState -Value @{ Token = $token; ExpiresOn = $expiresOn } -Account $user -Tenant $domainInside a pack connector’s Connect function: keeps the token for the pack’s tests.
Parameters
Section titled “Parameters”-Value
Section titled “-Value”What the pack needs to reach the service: a token, a client object or settings. Kept as it is.
Type: ObjectParameter Sets: (All)Aliases:
Required: TruePosition: 1Default value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Account
Section titled “-Account”The account or identity that is connected, shown by Get-MtTenantContext and in the report header.
Type: StringParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Tenant
Section titled “-Tenant”The tenant, organisation or workspace that is connected, shown with the account.
Type: StringParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Service
Section titled “-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: StringParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-WhatIf
Section titled “-WhatIf”Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameterParameter Sets: (All)Aliases: wi
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Confirm
Section titled “-Confirm”Prompts you for confirmation before running the cmdlet.
Type: SwitchParameterParameter Sets: (All)Aliases: cf
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.