Ways to connect to SQL Server using Powershell
Microsoft recommend to use SQLPS Module to manage SQL Server.Import the SQLPS Module into Windows Powershell environment
Check if SQLPS module is registered and available
Get-Module
Import SQLPS Module to Powershell console
Import-Module SQLPS
Ignore Warnings
Ignore the Module Load if already loaded
if (-not (Get-Module SQLPS)) {Import-Module SQLPS}
List out SQLPS Commands
Get-Command