Register-AdsHandle

SYNOPSIS

Registers and returns a symbol handle.

SYNTAX

NetIdPortSymbol (Default)

Register-AdsHandle [-NetId <AmsNetId>] -Port <Int32> [-Path] <String[]> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

RouteSymbol

Register-AdsHandle -Route <IRoute> -Port <Int32> [-Path] <String[]> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

AddressSymbol

Register-AdsHandle -Address <String> -Port <Int32> [-Path] <String[]> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

SessionSymbol

Register-AdsHandle -Session <ISession> [-Path] <String[]> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

SessionIdSymbol

Register-AdsHandle -SessionId <Int32> [-Path] <String[]> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

InputObject

Register-AdsHandle [-InputObject] <ISymbol[]> [-ProgressAction <ActionPreference>] [<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 | get-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

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.

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.

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).

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.

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.

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.

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.

Type: ISymbol[]
Parameter Sets: InputObject
Aliases: Symbol

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
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.

INPUTS

TwinCAT.ISession

The Session to use (instead of addressing the target system).

TwinCAT.TypeSystem.ISymbol[]

The symbol object.

OUTPUTS

NOTES