title: Unable to properly call sqlcmd from powershell
body: <p>I had this sqlcmd snippet working in batch but when I converted to powershell, it broke. This is what I am attempting to call using powershell</p>
  
  <pre><code>Sqlcmd -S localhost\instance -d database -U username -P password -i "sqlQuery.sql" -s "," &gt; \sqlOutput.csv -I -W -k
  </code></pre>
  
  <p>I tried invoke-sqlcmd but i get the error "The term 'invoke-sqlcmd' is not recognized as the name of a cmdlet, function, script file, or operable program"</p>
  
  <p>In regards to the comment below, I have loaded the snapins required. This did help but I am now getting this error. "Invoke-sqlcmd : Parameter cannot be processed because the parameter name 's' is ambiguous.</p>
  
  <p>If I put it in single quotes...</p>
  
  <pre><code>invoke-Sqlcmd '-S localhost\instance -d database -U username -P password -i "sqlQuery.sql" -s "," &gt; \sqlOutput.csv -I -W -k'
  </code></pre>
  
  <p>I get the error "A network-related or instance-specific error occurred while establishing a connectiong to sql server. Which doesn't make sense to me as the same credentials i am using here (on the same box) work when called from batch.</p>