I am trying to use the SqlServer PowerShell module, available on the PowerShell Gallery.
After installing, either to -Scope CurrentUser or in an admin session, doing Import-Module SqlServer only results in three commands being imported into the session:
PS C:\Users\nreiling> Get-Command -Module SqlServer
CommandType Name Version Source
----------- ---- ------- ------
Alias Decode-SqlName 21.0.17262 sqlserver
Alias Encode-SqlName 21.0.17262 sqlserver
Function SQLSERVER: 21.0.17262 sqlserver
This is in spite of the fact that doing (Get-Module -Name SqlServer -ListAvailable)[0].ExportedCommands.Values lists out all of the commands that are supposed to be included:
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-RoleMember 21.0.17262 SqlServer
Cmdlet Add-SqlAvailabilityDatabase 21.0.17262 SqlServer
Cmdlet Add-SqlAvailabilityGroupListenerStaticIp 21.0.17262 SqlServer
Cmdlet Add-SqlAzureAuthenticationContext 21.0.17262 SqlServer
Cmdlet Add-SqlColumnEncryptionKeyValue 21.0.17262 SqlServer
Cmdlet Add-SqlFirewallRule 21.0.17262 SqlServer
Cmdlet Add-SqlLogin 21.0.17262 SqlServer
Cmdlet Backup-ASDatabase 21.0.17262 SqlServer
Cmdlet Backup-SqlDatabase 21.0.17262 SqlServer
...
Cmdlet Test-SqlSmartAdmin 21.0.17262 SqlServer
Cmdlet Write-SqlTableData 21.0.17262 SqlServer
Function SQLSERVER: 21.0.17262 SqlServer
Alias Decode-SqlName 21.0.17262 SqlServer
Alias Encode-SqlName 21.0.17262 SqlServer
I tried installing an older version of the SqlServer module, as well as tried a different user account on my machine. Lots of reboots, new PS sessions, etc. Running Import-Module in verbose/debug mode doesn't throw any errors, it just imports only the function and aliases; none of the Cmdlets. The problem factor seems to be this particular Windows system, which is Windows 10 Pro 1803.
It is also worth noting that I'm only trying to use this module because the sqlps module that comes installed with SQL Server Management Studio stopped working on this machine. I don't know why that was the case; my guess was relating to a Windows or SSMS update, but in order to get to the point here where at least the SqlServer module installs without errors and warnings about clobbering, I removed that module from my $PSModulePath. Something else that broke seemingly at the same time was that my WSMan TrustedHosts list was reset (to blank), causing issues with PowerShell remoting that I had solved previously (this machine is not domain-joined).
How in the heck do I troubleshoot this?