Search code examples
sql-serverwindowspowershellpowershell-remoting

SQLServer module installed but SQLSERVER:\ drive not found


I've installed the SqlServer module on my windows machine with no issues. However, when I try to cd into the SQLSERVER:\ drive, it says it does not exist. I have to run a help on a function provided by the SqlServer module, and THEN it seems to do some implicit loading which allows me to cd into the SQLSERVER:\ drive. This is all done remotely (though I've tried it after RDPing into the box with the same result). Is there a way to fix this workaround?

Running Get-Module -Name SqlServer -ListAvailable returns:

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     22.0.59    SQLServer                           {Add-RoleMember, Add-SqlAvailabilityDatabase, Add-SqlAvail...

But running cd SQLSERVER:\ before I run a help returns:

cd : Cannot find drive. A drive with the name 'SQLSERVER' does not exist.

Solution

  • Just import the module first

    Import-Module SQLServer;