Install the SQL Server PowerShell Module from PowerShell Gallery
PowerShell commands such as https://docs.microsoft.com/en-us/powershell/module/sqlserver/invoke-sqlcmd?view=sqlserver-ps may require installation of the https://docs.microsoft.com/en-us/powershell/module/sqlserver/?view=sqlserver-ps. The module is supported by Microsoft but may not be included in default installations of PowerShell on Windows.
To download and install the SQL Server module https://docs.microsoft.com/en-us/sql/powershell/download-sql-server-ps-module?view=sql-server-ver15
Â