Powershell: Args/params not being populated

Question:

I have a PowerShell script:

The Write-Host part is for debugging.
I run it as .\csvtosql.ps1 mycsv.csv dbo.MyTable (from powershell shell), and get

I get exactly the same error with any parameters that I pass, also the same error if I try to use named parameters.

What can cause parameters not to be passed in?

UPDATE: PowerShell ISE asks me for these parameters using GUI prompts, then gives me the same error about them not being passed in.

Answer:

Source:

Powershell: Args/params not being populated by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply