Private/ConvertTo-SwEngine.ps1
Function ConvertTo-SwEngine{ <# .SYNOPSIS Create a powershell object from [Parmis.Solarwinds.Engine] class .DESCRIPTION This function simply get a custom object as an input an convert it to the standard [Parmis.Solarwinds.Engine] class .EXAMPLE PS> ConvertTo-SwEngine -Object $myCustomObject Id : 1 Name : PollingEngine01 IP : 192.168.100.10 ServerType : Primary Elements : 2479 Nodes : 130 Interfaces : 1337 Volumes : 1012 #> [Cmdletbinding()] [OutputType([Parmis.Solarwinds.Engine])] Param ( [Parameter(Mandatory = $true)] $Object ) Write-Verbose -Message "Converting to target object ..." $output = [Parmis.Solarwinds.Engine]::new() $output.Id = $Object.Engineid $output.Name = $Object.ServerName $output.IP = $Object.IP $output.ServerType = $Object.ServerType $output.Elements = $Object.Elements $output.Nodes = $Object.Nodes $output.Interfaces = $Object.Interfaces $output.Volumes = $Object.Volumes return $output } |