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

PI Powershell

ExportAFXml Class

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

Export XML representation of AF Objects to file or to System.IO.Stream

The Export-AFXml cmdlet exports the XML representation of an AF object or AF objects to a file or to a System.IO.Stream.

If only a single AF Object is to be exported, use the -AFObject switch to pass the object to be exported. If multiple AF Objects of the same type are to be exported, ie, a collection of AF Elements, use the corresponding plural switch. In this case, -AFElements.

Inheritance Hierarchy

SystemObject
  InternalCommand
    Cmdlet
      PSCmdlet
        OSIsoft.PowerShellOSICmdletBase
          OSIsoft.PowerShellExportAFXml

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

Syntax

[CmdletAttribute("Export", "AFXml", SupportsShouldProcess = true)]
public class ExportAFXml : OSICmdletBase
<CmdletAttribute("Export", "AFXml", SupportsShouldProcess := true)>
Public Class ExportAFXml
	Inherits OSICmdletBase

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

The ExportAFXml type exposes the following members.

Constructors

  NameDescription
Public method
ExportAFXml

Properties

  NameDescription
Public property
AFAttributes

AF Attributes to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFAttributeTemplates

AF Attribute Templates to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFCategories

AF Categories to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFDatabases

AF Databases to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFElements

AF Elements to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFElementTemplates

AF Element Templates to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFEventFrames

AF Event Frames to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFObject

Single AF Object to export. If a collection (>1) objects is to be exported, use the appropriate plural parameter.

Public property
AFPorts

AF Ports to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFSecurityIdentities

AF Security Identities to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFSecurityMappings

AF Security Mappings to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFServer

AF Server object to export. Note that the AF Server object only includes: AFContact, AFNotificationContactTemplate, and UOMDatabase objects. All other objects must be exported via the AF Database object.

Public property
AFUnitOfMeasureClasses

AF Unit of Measure Classes to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
AFUnitsOfMeasure

AF Units of Measure to export. If only one is to be exported, use the -AFObject parameter instead.

Public property
EndTime

Latest ending time for AF Objects that may be a part of the export

Public property
ExportMode

Export mode which indicates the amount of data to export

Public property
File

Output file to write all exported AF Objects to. If the file does not exist, it will be created.

Public property
StartTime

Earliest starting time for AF Objects that may be a part of the export

Examples

Export-AFXml -ExportMode AllReferences -File "C:\exports\afserver.xml" -AFServer (Get-AFServer -Name "PIAF1")

Exports the AF Server object for "PIAF1" to an xml file. Note that the AF Server object only includes: AFContact, AFNotificationContactTemplate, and UOMDatabase objects. All other objects must be exported via the AF Database object.

Examples

Export-AFXml -ExportMode DefaultValues -File "C:\exports\afdatabases.xml" -AFDatabases $AllAFDatabases

Where:

$AllAFDatabases = Get-AFDatabase "*" -AFServer (Get-AFServer -Name "PIAF1")

Exports all AF Database objects on the PIAF1 AF Server to an xml file. Default values are included in the export.

Examples

Export-AFXml -File "C:\exports\afdatabases.xml" -AFObject $MySingleAFElement

Where:

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

Exports the single AF Element object and all child objects in $MySingleAFElement from the PIAF1 AF Server to an xml file. No extra information is contained in the export.

See Also

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