UPDATED CODE:
I have the following code. I wish to pass the InputTable to the nested script as a 2 dimensional string array, but I can't work out how to get this from the Get-Content (which appears to be a 1D array).
First Script:
$InputTablePath=C:\Temp\test.csv
$InputTable = Get-Content $InputTablePath
$scriptPath = 'C:\Temp\nested_script.csv
$m = Get-Content $tablePath
$rows = $m.count
$cols = ($m[0].split(",")).count
$InputTable = New-Object 'string[,]' $rows,$cols
for ($i=0;$i -lt $rows; $i++){
for ($j=0;$j -lt $cols; $j++){
$InputTable[$i,$j]= ($m[$i].split(","))[$j]
}
}
$argumentlist = "-InputTable '{0}'" -f $array
Invoke-Expression "& `"$scriptPath`" $argumentList"
Nested Script:
Param(
[string[,]]$InputTable
)
$numberOfRows = $InputTable.GetLength(0)
$numberOfColumns = $InputTable.GetLength(1)
etc....
I'm currently getting an index out of bounds error on the last line.
Many Thanks.