Write

The Write-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 write data is automatically mapped to appropriate (Plc) Data on the target side, dynamically.

Write Symbolic Data

PS> $session = New-TcSession -NetId 1.2.3.4.5.6 -Port 851
PS> $projectNameSymbol = $session | Get-TcSymbol -path "*ProjectName"
PS> $projectNameSymbol

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

PS> $projectNameSymbol | Read-TcValue

OldProjectName

PS> $projectNameSymbol | Write-TcValue -Value "NewProjectName" -force
PS> $projectNameSymbol | ReadTcValue

NewProjectName

This example shows how to create a session, determining the Symbol 'ProjectName within the _AppInfo Struct on a running PLC project and reading its value.

After that, the Value will be overwritten with 'NewProjectName'.

Write IndexGroup/IndexOffset Data

Write-TcValue -session $session -IndexGroup 0x4040 -IndexOffset 0x1247A8 -Value "NewProjectName"

Writes a string typed Value to the specified IndexGroup/IndexOffset Address.