How To | Reading / Writing Data Reads 256 Bytes via IndexGroup/IndexOffset from the specified target system and prints the out formatted as hexdump. 5.9.3 Read Write Values | Read Write Values 5.9.3.1 Read | Read The Read-TcValue Cmdlet can be called via IndexGroup/IndexOffset (Raw Data), via Handle or with Symbolic Information (Symbol path or Symbol Object). If symbolic information is used, then the calls will be type safe and the returned data is automatically mapped to appropriate (dynamically) created .NET types.
Read type safe data with symbolic information PS> $session = New-TcSession -NetId '1.2.3.4.5.6' -Port 851 PS> $symbol = $session | get-TcSymbol -Path 'TwinCAT_SystemInfoVarList._AppInfo.ProjectName' PS> $symbol | Read-TcValue ADS_DynSymbols Create an ADS Session/Connection, determine the 'ProjectName' Symbol from the running PLC Project, read the current value of the symbol and print it to the console. Read amount of bytes from IndexGroup/IndexOffset PS> Read-TcValue -IndexGroup 0x4040 -IndexOffset 0x1247a8 -NetId 172.17.62.105.1.1 -port 851 - size 0xff | format-hex 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00000000 41 44 53 5F 44 79 6E 53 79 6D 62 6F 6C 73 00 00 ADS_DynSymbols..
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000080 11 00 01 01 A0 86 01 00 14 00 5E 01 21 C2 15 00 .... ?....^.!A.. 00000090 00 7F F1 57 3B 83 6C 07 1E 00 00 00 00 00 00 00 .⌂сW;?l.........
000000A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000C0 41 44 53 5F 44 79 6E 53 79 6D 62 6F 6C 73 5F 50 ADS_DynSymbols_P 000000D0 6C 63 54 61 73 6B 00 00 00 00 00 00 00 00 00 00 lcTask.......... 000000E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............... Reads 256 Bytes via IndexGroup/IndexOffset from the specified target system and prints the out formatted as hexdump. Read data with IndexGroup/IndexOffset and specify the returned data type.
PS> Read-TcValue -session $session -IndexGroup 0x4040 -IndexOffset 0x1247A8 -ValueType String ADS_DynSymbols Reads a string typed value from IndexGroup / IndexOffset. In this example the ProjectName of the running PLC Project resides at that ProcessImage Address. Read data by Symbol handle PS> $route = Get-AdsRoute -Name 'CX-123456' PS> $session = $route | New-TcSession -Port 851 PS> $handle = $session | Send-TcReadWrite -IndexGroup SymbolHandleByName -WriteValue "GVL.vgInt" - ReadType Int32 -force PS> $session | Read-TcValue -IndexGroup SymbolValueByHandle -IndexOffset $handle -ValueType Int16 42 TE1000 24 Version: 1.5.0