Get-TcSymbol

SYNOPSIS

Get the symbols from a TwinCAT target system / Device.

SYNTAX

NetIdPort (Default)

Get-TcSymbol [[-Path] <String[]>] [-NetId <AmsNetId>] -Port <Int32> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

AddressStr

Get-TcSymbol [[-Path] <String[]>] -Address <String> -Port <Int32> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

Route

Get-TcSymbol [[-Path] <String[]>] -Route <IRoute> -Port <Int32> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

Session

Get-TcSymbol [[-Path] <String[]>] -Session <ISession> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

SessionId

Get-TcSymbol [[-Path] <String[]>] -SessionId <Int32> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

NetIdPortLiteral

Get-TcSymbol -LiteralPath <String[]> [-NetId <AmsNetId>] -Port <Int32> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

AddressStrLiteral

Get-TcSymbol -LiteralPath <String[]> -Address <String> -Port <Int32> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

RouteLiteral

Get-TcSymbol -LiteralPath <String[]> -Route <IRoute> -Port <Int32> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

SessionLiteral

Get-TcSymbol -LiteralPath <String[]> -Session <ISession> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

SessionIdLiteral

Get-TcSymbol -LiteralPath <String[]> -SessionId <Int32> [-Recurse] [-Force] [-IncludeArrays]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

This Cmdlet get the symbolic information from a target system if symbols are provided.

The information can be determined via different Providers (e.g.

ADS, MQTT, OPC).

EXAMPLES

EXAMPLE 1

PS> Get-TcSymbol -port 851
InstanceName              DataType Size InstancePath
------------              -------- ---- ------------
tc2vBool                  BOOL     1    .tc2vBool
tc2vInt                   INT      2    .tc2vInt
Constants                          0    Constants
GVL                                0    GVL
MAIN                               0    MAIN
Slow                               0    Slow
TwinCAT_SystemInfoVarList          0    TwinCAT_SystemInfoVarList

Get the root symbolic information from the local system (Port 851):

EXAMPLE 2

PS>$session = New-TcSession -NetId 1.2.3.4.5.6 -Port 851
PS>$session | Get-TcSymbol "TwinCAT_SystemInfoVarList._AppInfo" -recurse

 InstanceName       DataType             Size InstancePath
------------       --------             ---- ------------
_AppInfo           PLC.PlcAppSystemInfo 256  TwinCAT_SystemInfoVarList._AppInfo
ObjId              OTCID                4    TwinCAT_SystemInfoVarList._AppInfo.ObjId
TaskCnt            UDINT                4    TwinCAT_SystemInfoVarList._AppInfo.TaskCnt
OnlineChangeCnt    UDINT                4    TwinCAT_SystemInfoVarList._AppInfo.OnlineChangeCnt
Flags              DWORD                4    TwinCAT_SystemInfoVarList._AppInfo.Flags
AdsPort            UINT                 2    TwinCAT_SystemInfoVarList._AppInfo.AdsPort
BootDataLoaded     BOOL                 1    TwinCAT_SystemInfoVarList._AppInfo.BootDataLoaded
OldBootData        BOOL                 1    TwinCAT_SystemInfoVarList._AppInfo.OldBootData
AppTimestamp       DT                   4    TwinCAT_SystemInfoVarList._AppInfo.AppTimestamp
KeepOutputsOnBP    BOOL                 1    TwinCAT_SystemInfoVarList._AppInfo.KeepOutputsOnBP
ShutdownInProgress BOOL                 1    TwinCAT_SystemInfoVarList._AppInfo.ShutdownInProgress
LicensesPending    BOOL                 1    TwinCAT_SystemInfoVarList._AppInfo.LicensesPending
BSODOccured        BOOL                 1    TwinCAT_SystemInfoVarList._AppInfo.BSODOccured
TComSrvPtr         ITComObjectServer    4    TwinCAT_SystemInfoVarList._AppInfo.TComSrvPtr
AppName            STRING(63)           64   TwinCAT_SystemInfoVarList._AppInfo.AppName
ProjectName        STRING(63)           64   TwinCAT_SystemInfoVarList._AppInfo.ProjectName

Create a session to the target system '1.2.3.4.5.6' Port: 851 and get the symbol 'TwinCAT_SystemInfoVarList._AppInfo' and its subsymbols recursively.

EXAMPLE 3

PS> $session = New-TcSession -Name 'CX_123456' -port 851
PS> $session | Get-TcSymbol -recurse | where InstanceName -like 'Project*'

 InstanceName DataType   Size InstancePath
 ------------ --------   ---- ------------
 ProjectName  STRING(63) 64   TwinCAT_SystemInfoVarList._AppInfo.ProjectName

Gets an ADS-Session/Connection to the target system CX_123456 on port 851, downloads the symbol information recursively and returns all Instances where the instance name is like the pattern 'Project*'.

EXAMPLE 4

PS> $s = New-TcSession -port 851
PS> $s | Get-TcSymbol -path '.tc2vStructArray`[0`]','.tc2vStructArray`[1`]'

InstancePath        Category DataType        Size Static Persistant IG   IO
------------        -------- --------        ---- ------ ---------- ---- ------
.tc2vStructArray[0] Struct   ST_SimpleStruct 165  False  False      4040 117942
.tc2vStructArray[1] Struct   ST_SimpleStruct 165  False  False      4040 1179E7

Gets an ADS-Session/connection to the local system PLC (Port 851) and get two Array Elements.

Because the -path parameter uses the wildcard paramater '\[' and '\]' these characters must be escaped with backtick '\`'.

EXAMPLE 5

PS> $s = New-TcSession -port 851
PS> $s | Get-TcSymbol -literalPath '.tc2vStructArray[0]','.tc2vStructArray[1]'

InstancePath        Category DataType        Size Static Persistant IG   IO
------------        -------- --------        ---- ------ ---------- ---- ------
.tc2vStructArray[0] Struct   ST_SimpleStruct 165  False  False      4040 117942
.tc2vStructArray[1] Struct   ST_SimpleStruct 165  False  False      4040 1179E7

Gets an ADS-Session/connection to the local system PLC (Port 851) and gets two Array Elements with their literal path.

PARAMETERS

-Path

The instance path of the Symbol(s).

Because wildcards are permitted with path, the wildcard parameters '\[' and '\]' must be escaped with a backtick.

Type: String[]
Parameter Sets: NetIdPort, AddressStr, Route, Session, SessionId
Aliases:

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

-LiteralPath

The literal instance path of the symbol (Path access without wildcard).

Type: String[]
Parameter Sets: NetIdPortLiteral, AddressStrLiteral, RouteLiteral, SessionLiteral, SessionIdLiteral
Aliases:

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

-NetId

The target system NetId.

Type: AmsNetId
Parameter Sets: NetIdPort, NetIdPortLiteral
Aliases:

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

-Route

The target system route.

Type: IRoute
Parameter Sets: Route, RouteLiteral
Aliases:

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

-Address

The address for the target system where to get the symbol..

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

Wildcards are permitted.

Type: String
Parameter Sets: AddressStr, AddressStrLiteral
Aliases:

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

-Port

The target system port.

Type: Int32
Parameter Sets: NetIdPort, AddressStr, Route, NetIdPortLiteral, AddressStrLiteral, RouteLiteral
Aliases:

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

-Session

The session object that is used to get the symbols.

Type: ISession
Parameter Sets: Session, SessionLiteral
Aliases: InputObject

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

-SessionId

The unique id of the session object that is used to get the symbols.

Type: Int32
Parameter Sets: SessionId, SessionIdLiteral
Aliases: Id

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

-Recurse

Gets the symbol recursively.

Often used in conjunction with Wildcards in -Path

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Force

Forces to reload the symbols (forces to reload the internal cache)

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-IncludeArrays

Active only in recursive mode - ignored otherwise.

This parameter forces the Cmdlet to output all symbols - even Array Elements.

Please take care because the output can be very lengthy dependent on the Size of the Array.

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.ISession

The session object that is used to get the symbols.

OUTPUTS

NOTES