When I'm executing this command in PowerShell, everything works fine:
sqlcmd -S dwh -i ".\script.sql" -o ".\log.txt"
However, when I'd like to set up several jobs, the following command doesn't work:
Start-Job -Name TestSqlCmd -ScriptBlock {sqlcmd -S dwh -i ".\script.sql" -o ".\log.txt"}
I got the following error:
Sqlcmd: Error: Error occurred while opening or operating on file .\script.sql (Reason: The system cannot find the path specified).
+ CategoryInfo : NotSpecified: (Sqlcmd: Error: ...ath specified).:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
+ PSComputerName : localhost
Could you help me with that issue please?