< Back

Import-NsxObject

Sat Jan 18, 2020 9:13 pm

NAME Import-NsxObject



SYNOPSIS

Reads from the specified file and returns an XMLElement object or collection.





SYNTAX

Import-NsxObject [-FilePath] <String> [<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 re-import of files exported using

Export-NsxObject to use as if they had been retrieved directly from the API.

It is intended to be used in conjunction with Export-NsxObject





PARAMETERS

-FilePath <String>

Text Encoding used in export file.



Required? true

Position? 2

Default value

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