Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI Powershell

GetAFElement Class

  • Last UpdatedDec 15, 2025
  • 3 minute read
GetAFElement Class

Get an AF Element

The Get-AFElement cmdlet gets an AF Element. The element can be retrieved by name, ID, index, or by parent element.

Note that this cmdlet will only search the top level elements of the specified AF Database. Lower level elements can be accessed by then getting the child elements of the top level elements.

Inheritance Hierarchy

SystemObject
  InternalCommand
    Cmdlet
      PSCmdlet
        OSIsoft.PowerShellOSICmdletBase
          OSIsoft.PowerShellGetAFElement

Namespace:  OSIsoft.PowerShell
Assembly:  OSIsoft.PowerShell (in OSIsoft.PowerShell.dll) Version: 2.2.3.0 (2.2.3.952)

Syntax

[CmdletAttribute("Get", "AFElement", SupportsShouldProcess = true)]
public class GetAFElement : OSICmdletBase
<CmdletAttribute("Get", "AFElement", SupportsShouldProcess := true)>
Public Class GetAFElement
	Inherits OSICmdletBase

Dim instance As GetAFElement
[CmdletAttribute(L"Get", L"AFElement", SupportsShouldProcess = true)]
public ref class GetAFElement : public OSICmdletBase
[<CmdletAttribute("Get", "AFElement", SupportsShouldProcess = true)>]
type GetAFElement =  
    class
        inherit OSICmdletBase
    end

The GetAFElement type exposes the following members.

Constructors

  NameDescription
Public method
GetAFElement

Properties

  NameDescription
Public property
AFDatabase

AF Database containing AF Element

Public property
AFElement

Parent AF Element for which to get child elements (1 level deep)

Public property
ID

ID of the AF Element to get

Public property
Index

Index of the AF Element to get

Public property
Name

Name of the AF Element to get. Accepts wildcards. If element name is omitted, "*" will be used.

Public property
Refresh

Refresh the container before accessing

Examples

Get-AFElement -Name "Production Line 1" -AFDatabase $afDB

Where:

$afDB = Get-AFDatabase "AFDatabase1" -AFServer (Get-AFServer -Name "PIAF1")

Gets the top level element "Production Line 1" from the database "AFDatabase1" on the AF Server "PIAF1".

Examples

Get-AFElement -AFElement $afElement -Name "Boiler 1"

Where:

$afElement = Get-AFElement -Name "Production Line 1" -AFDatabase (Get-AFDatabase -Name "AFDatabase1" -AFServer (Get-AFServer -Name "PIAF1"))

Gets the child element of "Production Line 1" called "Boiler1" from the database "AFDatabase1" on the AF Server "PIAF1".

Examples

Get-AFElement -Name * -AFDatabase $afDB

Where:

$afDB = Get-AFDatabase -Name "AFDatabase1" -AFServer (Get-AFServer -Name "PIAF1")

Gets all top level elements from the database "AFDatabase1" on the AF Server "PIAF1".

See Also

TitleResults for “How to create a CRG?”Also Available in