Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 252940

Re: PowerCLI Distributed Switch Export

$
0
0

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.


Viewing all articles
Browse latest Browse all 252940

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>