From fb9a592e9e3d61d3afdf4f110d3ccedf07378126 Mon Sep 17 00:00:00 2001 From: jhoneill Date: Wed, 30 Oct 2019 16:16:41 +0000 Subject: [PATCH] Wasn't removing force from Param to passed thru --- Send-SQLDataToExcel.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Send-SQLDataToExcel.ps1 b/Send-SQLDataToExcel.ps1 index 280f82f..d9b254e 100644 --- a/Send-SQLDataToExcel.ps1 +++ b/Send-SQLDataToExcel.ps1 @@ -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 }