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

PI Powershell

AddAFAttribute Class

  • Last UpdatedDec 15, 2025
  • 5 minute read
AddAFAttribute Class

Add an AF Attribute

The Add-AFAttribute cmdlet creates a new AF Attribute. The attribute can be an attribute on an AF Element, or an AF Sub Attribute

Inheritance Hierarchy

SystemObject
  InternalCommand
    Cmdlet
      PSCmdlet
        OSIsoft.PowerShellOSICmdletBase
          OSIsoft.PowerShellAddAFAttribute

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

Syntax

[CmdletAttribute("Add", "AFAttribute", SupportsShouldProcess = true)]
public class AddAFAttribute : OSICmdletBase
<CmdletAttribute("Add", "AFAttribute", SupportsShouldProcess := true)>
Public Class AddAFAttribute
	Inherits OSICmdletBase

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

The AddAFAttribute type exposes the following members.

Constructors

  NameDescription
Public method
AddAFAttribute

Properties

  NameDescription
Public property
AFAttribute

Parent AF Attribute on which to create the new sub AF Attribute

Public property
AFElement

Parent AF Element on which to create the new AF Attribute

Public property
CheckIn

Check in changes immediately

Public property
DataReferencePluginName

Name of the data reference plugin to set on the new AF Attribute

Public property
DataReferenceProperties

Properties of the data reference plugin to use for the Value of the AF Attribute

Public property
DefaultUnitOfMeasure

Default unit of measure for the new AF Attribute

Public property
Description

Description of the new AF Attribute to set

Public property
IsConfigurationItem

Set the new AF Attribute as a configuration item

Public property
IsExcluded

Set the new AF Attribute as excluded for the associated AF Element

Public property
IsHidden

Set the new AF Attribute as hidden to client applications

Public property
Name

Name of the new AF Attribute to set

Public property
Type

Type to coerce value into

Public property
Value

Value of the new AF Attribute to set

Examples

Add-AFAttribute -Name "Interior Temperature" -Description "Interior temperature in celsius for Anneal Oven 1" -CheckIn -AFElement $afElement

Where:

$afElement = Get-AFElement -Name "Anneal Oven 1" -AFDatabase (Get-AFDatabase -Name "AFDatabase1" -AFServer (Get-AFServer -Name "PIAF1"))

Creates the AF Attribute "Interior Temperature" on the top level element "Anneal Oven 1" on the database "AFDatabase1" on the AF Server "PIAF1". A description is also added to the new attribute. The changes are immediately checked in.

Examples

Add-AFAttribute -Name "Interior Temperature" -DefaultUnitOfMeasure (Get-AFUnitOfMeasure -Name "degree celsius" -AFServer (Get-AFServer -Name "PIAF1")) -CheckIn -AFElement $afElement

Where:

$afElement = Get-AFElement -Name "Anneal Oven 1" -AFDatabase (Get-AFDatabase -Name "AFDatabase1" -AFServer (Get-AFServer -Name "PIAF1"))

Creates a new AF Attribute with name "Interior Temperature" and default unit of measure "degree celsius" on the top level element "Anneal Oven 1" on the database "AFDatabase1" on the AF Server "PIAF1". The changes are checked in immediately.

Examples

Add-AFAttribute -Name "Interior Temperature" -DefaultUnitOfMeasure (Get-AFUnitOfMeasure -Name "degree celsius" -AFServer (Get-AFServer -Name "PIAF1")) -DataReferencePluginName "PI Point" -CheckIn -AFElement $afElement

Where:

$afElement = Get-AFElement -Name "Anneal Oven 1" -AFDatabase (Get-AFDatabase -Name "AFDatabase1" -AFServer (Get-AFServer -Name "PIAF1"))

Creates a new AF Attribute with name "Interior Temperature" as a PI Point data reference and default UOM "degrees celsius" on the top level element "Anneal Oven 1" on the database "AFDatabase1" on the AF Server "PIAF1". The changes are checked in immediately.

Examples

Add-AFAttribute -Name "Temperature (F)" -DefaultUnitOfMeasure (Get-AFUnitOfMeasure -Name "degree fahrenheit" -AFServer (Get-AFServer -Name "PIAF1")) -DataReferencePluginName "PI Point" -CheckIn -AFAttribute $afAttribute

Where:

$afElement = Get-AFElement -Name "Anneal Oven 1" -AFDatabase (Get-AFDatabase -Name "AFDatabase1" -AFServer (Get-AFServer -Name "PIAF1"))

$afAttribute = Get-AFAttribute -Name "Interior Temperature" -AFElement $afElement

Creates a new sub AF Attribute with name "Temperature (F)" as a PI Point data reference and default UOM "degrees fahrenheit" on the top level element "Anneal Oven 1" on the database "AFDatabase1" on the AF Server "PIAF1". The changes are checked in immediately.

See Also

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