public/Import-VexaInventory.ps1
function Import-VexaInventory { param ( [String] $Path ) $XmlData = Import-Clixml -Path $Path $DcList = foreach ($DcObj in $XmlData.Datacenter) { [VexaDatacenter]::new($DcObj) } $CluList = foreach ($CluView in $XmlData.ClusterComputeResource) { [VexaClusterComputeResource]::new($CluView) } $VMHostList = foreach ($VMHostView in $XmlData.HostSystem) { [VexaHostSystem]::new($VMHostView) } @{ ClusterComputeResource = $CluList Datacenter = $DcList HostSystem = $VMHostList VIServer = [VexaVIServer]::new($XmlData.VIServer) } } |