Forum Discussion
FGNicky
Aug 24, 2022Copper Contributor
SQL2022 CTP using PowerShell to enable AlwaysOn
I'm trying to enable AlwaysOn using the following PowerShell script:
Enable-SqlAlwaysOn -ServerInstance $env:computername\$SQLServerInstance -NoServiceRestart
This works on SQL2019, but gives the following error on 2022:
Enable-SqlAlwaysOn : Could not obtain information about SQL Server Service 'MSSQL$SQL2022'.
At line:9 char:33
+ ... Enable-SqlAlwaysOn -ServerInstance $env:computername\$SQL ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (MSSQL$SQL2022:String) [Enable-SqlAlwaysOn], SqlPowerShellServiceException
+ FullyQualifiedErrorId : ServiceError,Microsoft.SqlServer.Management.PowerShell.Hadr.EnableSqlHADRServiceCommand
Is there a new version of the SQLServer module I need to get hold of?