Accessing Symbolic Information

Getting Root Symbols

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):

Browsing through Symbols recursively and filter with wildcards

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*'.

Browsing DataTypes

PS> Get-TcDataType -port 851
Name                      Size     Category   BaseType
----                      ----     --------   --------
BYTE                      1        Primitive
WORD                      2        Primitive
DINT                      4        Primitive
UDINT                     4        Primitive
DWORD                     4        Primitive
E_ByteEnum                1        Enum       BYTE
FB_Test                   12424    Struct
PLC.PlcAppSystemInfo      256      Struct
PLC.PlcTaskSystemInfo     128      Struct
POINTER TO BYTE           4        Pointer    BYTE
R_Range                   2        Alias      INT (-6..12)
REFERENCE TO BOOL         4        Reference  BOOL
ST_SimpleStruct           166      Struct
STRING(80)                81       String
...