I am running a script. But when trying to run it outside Powershell ISE it comes with the error "The term 'Invoke-SqlCommand' is not recognized as the name of a cmdlet".
The SQL module is importet via the script and in both cases the script is executed in the same user context. Any ideas?
and
Invoke-SqlCommand, or callImport-Module xxxx, where xxxx is the name of the module that defines it, or copy-paste the function directly into your script. Otherwise, see the nativeInvoke-SqlCmdcmdlets provided by Microsoft in their sqlps and sqlserver modules. - leeharvey1