When I try to run a powershell script I get the following error:
Invoke-Sqlcmd : The term 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet, function, script file, or operable program.
So in Powershell I ran the following:
install-module sqlserver
update-module sqlserverimport-module sqlserver
This all runs fine. If I then run Invoke-Sqlcmd I get the above error.
If I run this command:
Get-Command-Module sqlserver
I get this result:
CommandTypeNameVersionSource----------------------------AliasDecode-SqlName21.0.17224 sqlserverAliasEncode-SqlName21.0.17224 sqlserverFunction SQLSERVER:21.0.17224 sqlserver
Any ideas on what else I should try?
I have SQLServer 2014 and Powershell Version 5
I have also tried installing: powershelltools.msi, downloaded as part of the SQL Server 2014 Feature pack.