powershell command enable-alwayson not work for SQL Server Named instance Hi all,

I installed a SQL server 2016 default instance and a SQL Server 2017 named instance (instance name is SQL17) on my Windows 2012 Server.

I opened a powershell windows with administrator mode, import module SQLPS.
Then I run invoke-sqlcmd to query from the default instance and named instance, it works.
but when I run enable-sqlalwayson, it only worked for my default instance(I checked from SQL Server configuration mamanger), and get error with named instance.
Why?

Please refer the screenshot for detail error message.

Any help will be appreciate!
Check out this documentation and tweak your command slightly.

https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/enable-and-disable-always-on-availability-groups-sql-server?view=sql-server-2017

The example shows this as the proper command for an instance

Enable-SqlAlwaysOn -Path SQLSERVER:\SQL\Computer\Instance