Only a single command in "Get-Command -Module SqlServer" of "Invoke-SqlNotebook". How to get the rest?

81 Views Asked by At

I want to run Invoke-Sqlcmd but it's not found on my Windows 11 system

For some reason the only result is "Invoke-SqlNotebook"

I've removed, installed, imported, updated SqlServer module

Ran the following commands in PowerShell, and expected Invoke-SqlCmd to come up https://learn.microsoft.com/en-us/powershell/module/sqlserver/invoke-sqlcmd?view=sqlserver-ps

Install-Module -Name SqlServer -Force
Import-Module SqlServer
Get-Command -Module SqlServer

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Invoke-SqlNotebook                                 22.1.1     SqlServer


Get-Module SqlServer

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     22.1.1                SqlServer                           Invoke-SqlNotebook

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
1

There are 1 best solutions below

2
andrewjamesbowen On

Shortly after posting this I decided to upgrade PowerShell to the latest version 7.3.7 at the time of writing. All the appropriate modules appear such as Invoke-Sqlcmd.

When running out an support version of Powershell (7.1 in 2023), there's no warnings of incompatibility when installing modules, or at least installing the last compatible version instead of "succeeding". A bit disappointing user experience.

End of support for those with similar experience

https://learn.microsoft.com/en-us/powershell/scripting/install/powershell-support-lifecycle?view=powershell-7.3#powershell-end-of-support-dates