The following works fine - now I would like to change a date column in the DataTables output before writing back to the sql database:
Invoke-Sqlcmd -ServerInstance $instance -Database master -InputFile $scriptPath$script -OutputAs DataTables |
Write-SqlTableData -ServerInstance $collectionInstance -DatabaseName $collectionDatabase -SchemaName "dbo" -TableName $script.Replace(".sql","") -Force
...OutputAs DataTables | ForEach-Object {$_.CaptureDate = @( "'$($capturedate)'")} |
So add the For-Each to change the datatable output.