Try something like this to export the dvSwitch config
$si = Get-View ServiceInstance
$dvSwMgr = Get-View $si.Content.dvSwitchManager
$dvsw = Get-VirtualSwitch -Distributed -Name dvSw1
$selection = New-Object VMware.Vim.DVSSelection
$selection.dvsUuid = $dvsw.ExtensionData.Uuid
$dvswSaved = $dvSwMgr.DVSManagerExportEntity($selection)
$dvswSaved | Export-Clixml C:\dvswSaved.xml
And to import the dvSwitch configuration you can do
$si = Get-View ServiceInstance
$dvSwMgr = Get-View $si.Content.dvSwitchManager
$dvswRestore = Import-Clixml C:\dvswSaved.xml
$dvswImport = @()
$info = New-Object VMware.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.