On this Microsoft documentation page, it lists a lot of SQL Server PowerShell commands. But how can I use it? Should I install anything? I just installed SQL Server 2016 (without SSMS) and it seems that I can't use these commands.
PS C:\> gcm Enable-SqlAlwaysOn
gcm : The term 'Enable-SqlAlwaysOn' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ gcm Enable-SqlAlwaysOn
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Enable-SqlAlwaysOn:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
PS C:\> Get-Module -ListAvailable *sql*
asked Nov 14, 2022 at 16:32
1 Answer 1
Have you followed the instructions to install the SQL Server Powershell Module?
Install-Module -Name SqlServer
answered Nov 14, 2022 at 16:50
lang-sql