Register-AdsHandle
SYNOPSIS
Registers and returns a symbol handle.
SYNTAX
NetIdPortSymbol (Default)
Register-AdsHandle [-NetId <AmsNetId>] -Port <Int32> [-Path] <String[]>
[<CommonParameters>]
RouteSymbol
Register-AdsHandle -Route <IRoute> -Port <Int32> [-Path] <String[]>
[<CommonParameters>]
AddressSymbol
Register-AdsHandle -Address <String> -Port <Int32> [-Path] <String[]>
[<CommonParameters>]
SessionSymbol
Register-AdsHandle -Session <ISession> [-Path] <String[]>
[<CommonParameters>]
SessionIdSymbol
Register-AdsHandle -SessionId <Int32> [-Path] <String[]>
[<CommonParameters>]
InputObject
Register-AdsHandle [-InputObject] <ISymbol[]> [<CommonParameters>]
DESCRIPTION
This Cmdlet registers a symbol handle at the connected system. The handle is returned as AdsHandleInfo.
EXAMPLES
Example 1
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.
PARAMETERS
-NetId
The NetId address of the Target system The AmsNetId.
Type: AmsNetId
Parameter Sets: NetIdPortSymbol
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Route
Specifies the route of the target system. Tab completion: Completes route names from currently reachable ADS systems on the local TwinCAT system. The Route object.
Type: IRoute
Parameter Sets: RouteSymbol
Aliases: Destination
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Address
The Address of the target system where to register the symbol handle. The Address can consist of RouteName, NetId, IPAddress or HostName. Wildcards are permitted. Tab completion: Completes route names from currently reachable ADS systems on the local TwinCAT system. The address.
Type: String
Parameter Sets: AddressSymbol
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: True
-Session
The Session to use (instead of addressing the target system). The address.
Type: ISession
Parameter Sets: SessionSymbol
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
-SessionId
Specifies the Session (with unique ID) to use instead of specifying the target address. Tab completion: Completes IDs of active TwinCAT sessions (created with New-TcSession). The Session ID.
Type: Int32
Parameter Sets: SessionIdSymbol
Aliases:
Required: True
Position: Named
Default value: -1
Accept pipeline input: False
Accept wildcard characters: False
-Port
The address Port to use (always in combination with the NetId). ArgumentCompleter is supported. Tab completion: Completes well-known ADS port numbers and names (e.g., 851/Plc1, 10000/SystemService). The port.
Type: Int32
Parameter Sets: NetIdPortSymbol, RouteSymbol, AddressSymbol
Aliases:
Required: True
Position: Named
Default value: 10000
Accept pipeline input: False
Accept wildcard characters: False
-Path
The instance path to the symbol. The port.
Type: String[]
Parameter Sets: NetIdPortSymbol, RouteSymbol, AddressSymbol, SessionSymbol, SessionIdSymbol
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: True
-InputObject
The symbol object. The port.
Type: ISymbol[]
Parameter Sets: InputObject
Aliases: Symbol
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
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.