0

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

2

Have you followed the instructions to install the SQL Server Powershell Module?

Install-Module -Name SqlServer

https://learn.microsoft.com/en-us/sql/powershell/download-sql-server-ps-module?source=recommendations&view=sql-server-ver16

answered Nov 14, 2022 at 16:50

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.