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

PI Powershell

AddAFElement Class

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

Add an AF Element

The Add-AFElement cmdlet adds a new AF Element. To add the element as a top level element, add the element to an AF Database. The element can also be added to an existing AF Element as a child element.

Inheritance Hierarchy

SystemObject
  InternalCommand
    Cmdlet
      PSCmdlet
        OSIsoft.PowerShellOSICmdletBase
          OSIsoft.PowerShellAddAFElement

Namespace:  OSIsoft.PowerShell
Assembly:  OSIsoft.PowerShell (in OSIsoft.PowerShell.dll) Version: 3.1.1.0 (3.1.1.466)

Syntax

[CmdletAttribute("Add", "AFElement", DefaultParameterSetName = "AFElementFromElement", 
	SupportsShouldProcess = true)]
public class AddAFElement : OSICmdletBase
<CmdletAttribute("Add", "AFElement", DefaultParameterSetName := "AFElementFromElement", 
	SupportsShouldProcess := true)>
Public Class AddAFElement
	Inherits OSICmdletBase

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

The AddAFElement type exposes the following members.

Constructors

  NameDescription
Public method
AddAFElement

Properties

  NameDescription
Public property
AFCategories

AF Categories this element belongs to

Use Get-AFCategory to get the Categories to apply to the element

Public property
AFDatabase

AF Database to which the element should be added

Public property
AFElement

Parent AF Element to which the new element should be added

Public property
AFElementTemplate

AF Element Template to base AF Element on

Use Get-AFElementTemplate to get the Element Template from which to add the Element

Public property
AFReferenceType

Specify the hierarchical relationship between the newly created element and the element which owns this collection of elements

Public property
CheckIn

Check in changes immediately

Public property
Description

Description of AF Element to create

Public property
ExtendedProperties

Extended properties of the new element

Public property
Name

Name of the AF Element to create

Examples

Add-AFElement -Name "Boiler 1" -AFDatabase $afDB -CheckIn

Where:

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

Adds the top level element "Boiler 1" to the database "AFDatabase1" on the AF Server "PIAF1". The change is checked in immediately.

Examples

Add-AFElement -AFElement $afElement -Name "Boiler 1" -Description "Boiler on Production Line 1" -CheckIn

Where:

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

Adds a child element of "Production Line 1" called "Boiler 1" to the database "AFDatabase1" on the AF Server "PIAF1". The change is checked in immediately.

See Also

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