Wasn't removing force from Param to passed thru

This commit is contained in:
jhoneill
2019-10-30 16:16:41 +00:00
parent d2a378ffda
commit fb9a592e9e

View File

@@ -180,7 +180,7 @@
#if force was specified export even if there are no rows. If there are no columns, the query failed and export "null" if forced
if ($Force -or $DataTable.Rows.Count) {
#Call export-excel removing parameters which relate to the SQL query, and keeping the rest.
'Connection' , 'Database' , 'Session' , 'MsSQLserver' , 'SQL' , 'DataTable' , 'QueryTimeout' |
'Connection' , 'Database' , 'Session' , 'MsSQLserver' , 'SQL' , 'DataTable' , 'QueryTimeout' , 'Force' |
ForEach-Object {$null = $PSBoundParameters.Remove($_) }
if ($DataTable.Columns.Count) { Export-Excel @PSBoundParameters -InputObject $DataTable }
else { Export-Excel @PSBoundParameters -InputObject $null }