classes/Datacenter.ps1
class VexaDatacenter { [string] $Id [string] $Name [array] $Children VexaDatacenter(){} VexaDatacenter($View, $Children) { # Construct class using PowerCLI Get-View data $this.Id = $View.MoRef $this.Name = $View.Name $this.Children = $Children } VexaDatacenter($XmlObj) { # Reserialize this object from the Import-CliXml serialized data $this.Id = $XmlObj.Id $this.Name = $XmlObj.Name $this.Children = $XmlObj.Children } [array] GetArrayToCompare() { $Items = $this.PSObject.Properties.Where({ ($_.MemberType -eq "Property") -and -not ($_.Name -eq "Children") }) return $Items.ForEach({@{Name = $_.Name; Value = $_.Value}}) } } |