0

I have just installed SQL Server 2014 Express Exition, and are now faced with a prompt whenever turning to a powershell.

The prompt looks like this: SQLSERVER:\>

How can I disable this behavior and get my good old powershell back?

thilemann
  • 397
  • 4
  • 16
  • This should be in one of the PowerShell profiles i would imagine. Locations: http://technet.microsoft.com/en-us/magazine/2008.10.windowspowershell.aspx – Matt Nov 29 '14 at 01:33
  • 1
    a simple `cd C:` for example should take you back into "normal mode", other than the directory you start in there should be nothing keeping you from doing everything you did before. and if this bothers you so much you can change the profile like matt suggests – Paul Nov 29 '14 at 01:50
  • I had been looking at the various profiles, but was not able to find the modules that were loading. I realized that the profile were setup to run Get-Module -ListAvailable | Import-Module to import a couple of modules that I am using - unfortunately a side-effect is that all possible modules are also loaded, which were the culprit. Thank you for your suggestions. – thilemann Nov 29 '14 at 02:14
  • To elaborate, SQL Server Express adds to the environment path PSModulePath, which makes the modules load. – thilemann Nov 29 '14 at 02:20

1 Answers1

1

You can't necessarily disable the fact that loading SQLPS drops you in the SQLServer provider. A workaround would be to push and pop your current location when loading the module:

#SQLPS drops you in SQLSERVER drive.
    Push-Location
    Import-Module SQLPS -DisableNameChecking
    Pop-Location

I would definitely recommend this. While in the SQLServer provider, you get some wonky behavior (e.g. test-path \path\to\valid\share will fail).

Edit: Just noticed your comment - you could place the push and pop around the Get-Module -ListAvailable | Import-Module line for the same effect.

Cheers!

Cookie Monster
  • 1,741
  • 1
  • 19
  • 24