Get-TcDataType
SYNOPSIS
Get the DataTypes from a TwinCAT target system / Device.
SYNTAX
NetIdPort (Default)
Get-TcDataType [[-Name] <String[]>] [-NetId <AmsNetId>] -Port <Int32> [-ResetSymbols] [-Force] [-AsJson]
[<CommonParameters>]
Route
Get-TcDataType [[-Name] <String[]>] -Route <IRoute> -Port <Int32> [-ResetSymbols] [-Force] [-AsJson]
[<CommonParameters>]
AddressStr
Get-TcDataType [[-Name] <String[]>] -Address <String> -Port <Int32> [-ResetSymbols] [-Force] [-AsJson]
[<CommonParameters>]
Session
Get-TcDataType [[-Name] <String[]>] -Session <ISession> [-ResetSymbols] [-Force] [-AsJson]
[<CommonParameters>]
SessionId
Get-TcDataType [[-Name] <String[]>] -SessionId <Int32> [-ResetSymbols] [-Force] [-AsJson]
[<CommonParameters>]
DESCRIPTION
This Cmdlet get the DataTypes from a target system if symbolic information is provided by the device (Symbol Server running). The DataTypes can be determined via different Providers (e.g. ADS, MQTT, OPC, see the '-Provider' parameter.)
about_AdsSymbolProvider
Get-TcSymbol
EXAMPLES
Example 1
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
...
Get the data types from the local system (Port 851):
Example 2
PS> $types = Get-TcDataType -Name 'ST_*' -NetId 1.2.3.4.5.6 -Port 851
Gets the DataTypes with name pattern 'ST_*' from the NetId / Port address symbol server.
Example 3
PS> $session = New-TcSession -Name 'CX_123456' -port 851
PS> Get-TcDataType -Session $session | where ByteSize -gt 1KB
Gets an ADS-Session/Connection to the target system CX_123456 on port 851, downloads the datatype information and returns all the DataTypes that are larger than 1KB of Size.
PARAMETERS
-Name
The data type name(s) to get. Wildcards are permitted. Tab completion: Completes data type names from the target's symbol server. The name of the data type.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: True
-NetId
The NetID address of the target system where to load the datatypes (Local by default). Tab completion: Completes AmsNetId values from currently reachable routes on the local TwinCAT system. The net id.
Type: AmsNetId
Parameter Sets: NetIdPort
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Route
The Route object where to load the datatypes from (RouteTarget.Local by default). Tab completion: Completes route names from currently reachable ADS systems on the local TwinCAT system. The input object.
Type: IRoute
Parameter Sets: Route
Aliases: Destination
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Address
The address where to load the datatype descriptions. This can be the RouteName, NetId, the HostName or the IPAddress. Wildcards are permitted. Tab completion: Completes route names from currently reachable ADS systems on the local TwinCAT system. The address.
Type: String
Parameter Sets: AddressStr
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: True
-Port
The Port where to load the datatype descriptions. Tab completion: Completes well-known ADS port numbers and names (e.g., 851/Plc1, 10000/SystemService). The port.
Type: Int32
Parameter Sets: NetIdPort, Route, AddressStr
Aliases:
Required: True
Position: Named
Default value: 10000
Accept pipeline input: False
Accept wildcard characters: False
-Session
The session object to use for datatype upload. The port.
Type: ISession
Parameter Sets: Session
Aliases: InputObject
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-SessionId
The unique session Identifier that represents the session to ose for the datatype upload. Tab completion: Completes IDs of active TwinCAT sessions (created with New-TcSession). The port.
Type: Int32
Parameter Sets: SessionId
Aliases: Id
Required: True
Position: Named
Default value: -1
Accept pipeline input: False
Accept wildcard characters: False
-ResetSymbols
Resets the symbols and datatypes cache. Reset Symbols/Datatypes flags
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force
Forces the ADS access. The force switch
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AsJson
Exports the data as Json. The asJson switch
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
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.