ExportAFXml Class
- Last UpdatedDec 15, 2025
- 5 minute read
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
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
| Name | Description | |
|---|---|---|
| ExportAFXml |
Properties
| Name | Description | |
|---|---|---|
| AFAttributes | AF Attributes to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFAttributeTemplates | AF Attribute Templates to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFCategories | AF Categories to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFDatabases | AF Databases to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFElements | AF Elements to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFElementTemplates | AF Element Templates to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFEventFrames | AF Event Frames to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFObject | Single AF Object to export. If a collection (>1) objects is to be exported, use the appropriate plural parameter. | |
| AFPorts | AF Ports to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFSecurityIdentities | AF Security Identities to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFSecurityMappings | AF Security Mappings to export. If only one is to be exported, use the -AFObject parameter instead. | |
| 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. | |
| AFUnitOfMeasureClasses | AF Unit of Measure Classes to export. If only one is to be exported, use the -AFObject parameter instead. | |
| AFUnitsOfMeasure | AF Units of Measure to export. If only one is to be exported, use the -AFObject parameter instead. | |
| EndTime | Latest ending time for AF Objects that may be a part of the export | |
| ExportMode | Export mode which indicates the amount of data to export | |
| File | Output file to write all exported AF Objects to. If the file does not exist, it will be created. | |
| 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 $AllAFDatabasesWhere:
$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 $MySingleAFElementWhere:
$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.