Functions/Test-ReturningObject.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
Function Test-ReturningObject { [CmdletBinding()] Param ( [Parameter(Mandatory)][string[]]$TestArray, [Parameter(Mandatory)][string]$TestNotArray ) $HashTable = @() Write-Verbose "Test Array is: $TestArray" Write-Verbose "TestNotArray is: $TestNotArray" [int]$I = 1 ForEach ($Item in $TestArray) { Write-Verbose "$I" $I++ Write-Verbose "$Item" $HashTable += @( [pscustomobject]@{ ArrayItem = $Item ItemNumber = $I } ) } $HashTable } |