Functions/New-IAViewObject.ps1
Function New-IAViewObject{ Param( [Parameter(Mandatory = $true)] [String]$Name, [String]$Description, [Nullable[Int]]$Order, [PSObject]$IACategory ) $IAViewObject = New-Object -TypeName PSObject $IAViewObject | Add-Member -MemberType NoteProperty -Name 'Name' -Value $Name if($Description){ $IAViewObject | Add-Member -MemberType NoteProperty -Name 'Description' -Value $Description } if($Order){ $IAViewObject | Add-Member -MemberType NoteProperty -Name 'Order' -Value $Order } if(!$IACategory){ $IACategory = Get-IACategory -All | Out-GridView -PassThru } $IAViewObject | Add-Member -MemberType NoteProperty -Name 'CategoryId' -Value $IACategory.Id return $IAViewObject } |