# Get-MtConnectionState

Returns what a Maester Pack connector kept with Set-MtConnectionState, or nothing when it is not connected.

Source: https://maester.dev/docs/commands/Get-MtConnectionState

## SYNOPSIS

Returns what a Maester Pack connector kept with Set-MtConnectionState, or nothing when it is not connected.

## SYNTAX

```powershell
Get-MtConnectionState [[-Service] <String>] [-Detailed] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]
```

## DESCRIPTION

A pack's tests and helpers call this to reach the service their connector connected to (Maester Packs
design, section 6.1).
Inside a pack, it returns the state of the pack's own connector, or of a pack it
requires; one pack cannot read another pack's connection.
Called from outside a pack, -Service is
required.

By default the value the connector kept is returned.
-Detailed returns Service, Value, Account, Tenant
and ConnectedAt.

## EXAMPLES

### EXAMPLE 1

```powershell
$token = (Get-MtConnectionState).Token
```

Inside a pack test: the token the pack's connector kept.

### EXAMPLE 2

```powershell
Get-MtConnectionState -Service CNT.GoogleWorkspace -Detailed
```

At the console: who is connected to the service of an installed pack.

## PARAMETERS

### -Service

The connector's service name, such as CNT.GoogleWorkspace.
Needed only when the pack has more than one
connector, or outside a pack.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

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

### -Detailed

Return the whole record: Service, Value, Account, Tenant and ConnectedAt.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
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.

```yaml
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](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### System.Object

## NOTES

## RELATED LINKS

[https://maester.dev/docs/commands/Get-MtConnectionState](https://maester.dev/docs/commands/Get-MtConnectionState)
