I have tried below code and I'm getting this error message. But I'm getting the output generated, is there any way to avoid the error?
Invoke-expression (sqlcmd -S Servername -d DBName -i "D:\Test\Test_files\sample.sql" -h-1 -o "D:\Test\Test_files\test\testfile1.txt")
Error:Invoke-Expression : Cannot bind argument to parameter 'Command' because it is null.