AddAFElement Class
- Last UpdatedDec 15, 2025
- 3 minute read
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
InternalCommand
Cmdlet
PSCmdlet
OSIsoft.PowerShellOSICmdletBase
OSIsoft.PowerShellAddAFElement
Namespace: OSIsoft.PowerShell
Assembly: OSIsoft.PowerShell (in OSIsoft.PowerShell.dll) Version: 2.2.3.0 (2.2.3.952)
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
| Name | Description | |
|---|---|---|
| AddAFElement |
Properties
| Name | Description | |
|---|---|---|
| AFCategories | AF Categories this element belongs to Use Get-AFCategory to get the Categories to apply to the element | |
| AFDatabase | AF Database to which the element should be added | |
| AFElement | Parent AF Element to which the new element should be added | |
| AFElementTemplate | AF Element Template to base AF Element on Use Get-AFElementTemplate to get the Element Template from which to add the Element | |
| AFReferenceType | Specify the hierarchical relationship between the newly created element and the element which owns this collection of elements | |
| CheckIn | Check in changes immediately | |
| Description | Description of AF Element to create | |
| ExtendedProperties | Extended properties of the new element | |
| Name | Name of the AF Element to create |
Examples
Add-AFElement -Name "Boiler 1" -AFDatabase $afDB -CheckInWhere:
$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.