Objects in Powershell

$List = New-Object System.Collections.Generic.List[System.Object]

foreach($User in $Users){

    ### Your processing code goes here ###

    $props = @{
        UPN = $User.User
        Type = $Type
    $object = new-object psobject -Property $props

This is my second version of this as I more often want to create custom objects in a loop as the standard properties are missing something or I want to add a value from another query.
I’ve used $Users here as my input array as that’s what I most commonly have to use.

I’ve used a list here instead of an array as they are faster. You can append to a list. To add to an array you actually have to create an array one larger than the last array, populate it with the previous values and the the one you want to add.

Further reading: https://social.technet.microsoft.com/wiki/contents/articles/7804.powershell-creating-custom-objects.aspx