< Back
Export-NsxObject
Post
NAME Export-NsxObject
SYNOPSIS
Accepts any XMLElement and formats it and writes it to the specified file.
SYNTAX
Export-NsxObject -Object <XmlElement[]> [-FilePath] <String> [-Encoding <Object>] [-NoClobber] [<CommonParameters>]
DESCRIPTION
Most PowerNSX Objects are internally handled as XMLELement objects.
For objects (or collections of objects) that are XMLElements, this cmdlet
will format them (using format-xml) and then write them to disk using the
specified encoding.
An export file created in this fashion can be edited by hand with complete
onus on the user to ensure the XML remains well formed and continues to be
a 'valid' NSX object.
The intent of this cmdlet is to allow easy storage of any PowerNSX objects
to disk so they can be later re-imported to use as if they had been
retrieved directly from the API. It is intended to be used in conjunction
with Import-NsxObject
PARAMETERS
-Object <XmlElement[]>
PowerNSX Object to be exported
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-FilePath <String>
Text Encoding used in export file.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Encoding <Object>
Encoding type used in the output file. Defaults to utf-8 as the typical encoding for xml
Required? false
Position? named
Default value utf8
Accept pipeline input? false
Accept wildcard characters? false
-NoClobber [<SwitchParameter>]
Prevents overwriting an existing file. Defaults to $True
Required? false
Position? named
Default value True
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-NsxEdge Edge01 | Export-NsxObject -FilePath EdgeExport.xml
C:\\ PS>$ImportedEdge = Import-NsxObject -FilePath EdgeExport.xml
Exports the XMLElement object returned by Get-NsxEdge as formatted
XML to the file ExdgeExport.xml in the current directory and then imports
the content of the same file and stores the XML object in the variable
$ImportedEdge.
RELATED LINKS
SYNOPSIS
Accepts any XMLElement and formats it and writes it to the specified file.
SYNTAX
Export-NsxObject -Object <XmlElement[]> [-FilePath] <String> [-Encoding <Object>] [-NoClobber] [<CommonParameters>]
DESCRIPTION
Most PowerNSX Objects are internally handled as XMLELement objects.
For objects (or collections of objects) that are XMLElements, this cmdlet
will format them (using format-xml) and then write them to disk using the
specified encoding.
An export file created in this fashion can be edited by hand with complete
onus on the user to ensure the XML remains well formed and continues to be
a 'valid' NSX object.
The intent of this cmdlet is to allow easy storage of any PowerNSX objects
to disk so they can be later re-imported to use as if they had been
retrieved directly from the API. It is intended to be used in conjunction
with Import-NsxObject
PARAMETERS
-Object <XmlElement[]>
PowerNSX Object to be exported
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-FilePath <String>
Text Encoding used in export file.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Encoding <Object>
Encoding type used in the output file. Defaults to utf-8 as the typical encoding for xml
Required? false
Position? named
Default value utf8
Accept pipeline input? false
Accept wildcard characters? false
-NoClobber [<SwitchParameter>]
Prevents overwriting an existing file. Defaults to $True
Required? false
Position? named
Default value True
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-NsxEdge Edge01 | Export-NsxObject -FilePath EdgeExport.xml
C:\\ PS>$ImportedEdge = Import-NsxObject -FilePath EdgeExport.xml
Exports the XMLElement object returned by Get-NsxEdge as formatted
XML to the file ExdgeExport.xml in the current directory and then imports
the content of the same file and stores the XML object in the variable
$ImportedEdge.
RELATED LINKS