Handle Access
Register/Unregister a handle to a Symbol Path
PS> $session = New-TcSession -NetId '1.2.3.4.5.6' -Port 851
PS> $handleInfo = $session | Register-AdsHandle -Path 'TwinCAT_SystemInfoVarList._AppInfo.ProjectName'
PS> $handleInfo = Register-AdsHandle -Path 'TwinCAT_SystemInfoVarList._AppInfo.ProjectName' -Session $s
PS> $handleInfo
InstancePath Result Handle
------------ ------ ------
TwinCAT_SystemInfoVarList._AppInfo.ProjectName NoError 0x428000FC (1115685116)
PS> Read-TcValue -Session $session -IndexGroup SymbolValueByHandle -IndexOffset $handleInfo.Handle -Type String
MyProject
PS> $handle | Unregister-AdsHandle -Session $session
PS> $session | Close-tcsession
Opens a new device session, registers a Symbol Handle to the ProjectName of the running PLC Project, Reads the value by handle unregisters the handle and closes the session again.