New-TcSession

SYNOPSIS

Create a new session to a TwinCAT Target.

SYNTAX

NetIdPort (Default)

New-TcSession [[-NetId] <AmsNetId>] [-Port] <Int32> [-Force] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

Route

New-TcSession -InputObject <IRoute> [-Port] <Int32> [-Force] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

AddressStr

New-TcSession [-Provider <String>] [-Address] <String> [[-Port] <Int32>] [-Force]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Creates a new Point-To-Point Connection to a TwinCAT Target that is represented by the returned session object.

Different types of Sessions can be accessed by the registered types of SessionProviders (e.g.

ADS, MQTT, OPC).

If using ADS as protocol, this Cmdlet is equivalent to create and connect an ADSClient.

The Address of the remote system is the AmsNetId and AmsPort.

EXAMPLES

EXAMPLE 1

PS> $route = Get-AdsRoute -Name "Tc3*"
PS> $session = New-TcSession -Route $route -Port 851
PS> $session

ID Address               IsConnected EstablishedAt
-- -------               ----------- -------------
5  172.17.62.105.1.1:851 True        12/12/2016 12:22:02 PM

Establishes a new ADS Session/Connection to the specified route destination that has the name pattern "tc3*" via port 851 (PLC1)

EXAMPLE 2

PS> New-TcSession -NetId '172.17.62.105.1.1' -port 851

ID Address               IsConnected EstablishedAt
-- -------               ----------- -------------
5  172.17.62.105.1.1:851 True        12/12/2016 12:22:02 PM    ///

Establishes a new Ads Session/Connection to the specified NetId/Port address.

EXAMPLE 3

PS> New-TcSession -Name 'CX_123456' -port 851

ID Address               IsConnected EstablishedAt
-- -------               ----------- -------------
5  172.17.62.105.1.1:851 True        12/12/2016 12:22:02 PM

Establishes a new Ads Session/Connection to the target system with the Name/HostName 'CX_123456' (Port 851).

PARAMETERS

-NetId

The NetID Address

Type: AmsNetId
Parameter Sets: NetIdPort
Aliases:

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

-InputObject

The route target object.

Type: IRoute
Parameter Sets: Route
Aliases: Destination, Route

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

-Provider

Selects the session provider registered on the System (ADS by default)

Type: String
Parameter Sets: AddressStr
Aliases:

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

-Address

The target address of the new session.

This can be the NetId, the HostName or the IPAddress.

Wildcards are permitted.

Type: String
Parameter Sets: AddressStr
Aliases: Name

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

-Port

The AmsPort Address of the new session.

Type: Int32
Parameter Sets: NetIdPort, Route
Aliases:

Required: True
Position: 2
Default value: 10000
Accept pipeline input: False
Accept wildcard characters: False
Type: Int32
Parameter Sets: AddressStr
Aliases:

Required: False
Position: 2
Default value: 10000
Accept pipeline input: False
Accept wildcard characters: False

-Force

Forces to create the session independant of ReachableRoutes

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-ProgressAction

{{ Fill ProgressAction Description }}

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

TwinCAT.IRoute

The route target object.

OUTPUTS

NOTES