I'm exasperated, trying not to resort to using a $Global variable to pass variable, I've seen the other seemingly identical "subjects" in this forum but in the details I am lost or it appears that they are doing something different - or I just don't understand the question or solution.
I am getting an array of event objects from a Get-WinEvent in func1. I want to return that array and use it as an argument for another func2.
CASE#1
$evtArray = Get-WinEvt -FilterHashtable @{ LogName=Application } #simplified for brevity
return $evtArray #not sure if working or not
return ,$evtArray #not sure if working or not
return @,$evtArray #not sure if working or not
}**```
```**function func2($evtArray) { #doesn't work
function func2( ,$evtArray ) #syntax error
function func2( ,($evtArray)) #syntax error
....further processing of the $evtArray occurs......**```
CASE#2 (may be the same as CASE#1 - not sure)
```**$array += ,(<date-time1>,[int],"string")
$array += ,(<date-time2>,[int],"string")**
....
Then pass $array as argument to a function
**func2($array)**
I've spent some hours on this and seen a dozen promising looking same subjects......
Get-Something -SomeParameter $evtarray