Try something like this to export the dvSwitch config
$si=Get-ViewServiceInstance
$dvSwMgr=Get-View$si.Content.dvSwitchManager
$dvsw=Get-VirtualSwitch-Distributed-NamedvSw1
$selection=New-ObjectVMware.Vim.DVSSelection
$selection.dvsUuid=$dvsw.ExtensionData.Uuid
$dvswSaved=$dvSwMgr.DVSManagerExportEntity($selection)
$dvswSaved|Export-ClixmlC:\dvswSaved.xml
And to import the dvSwitch configuration you can do
$si=Get-ViewServiceInstance
$dvSwMgr=Get-View$si.Content.dvSwitchManager
$dvswRestore=Import-ClixmlC:\dvswSaved.xml
$dvswImport=@()$info=New-ObjectVMware.Vim.EntityBackupConfig
$info.ConfigBlob=$dvswRestore.ConfigBlob
$info.ConfigVersion=$dvswRestore.ConfigVersion
$info.Container=$dvswRestore.Container
$info.EntityType=$dvswRestore.EntityType
$info.Key=$dvswRestore.Key
$info.Name=$dvswRestore.Name
$dvswImport+=$info
$dvSwMgr.DVSManagerImportEntity(@($dvswImport),"applyToEntitySpecified")
The reason all the properties are copied on the restore is to avoid the serialisation/deserialisation problem.