Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

PowerShell & System DBs

  • Filter
  • Time
  • Show
Clear All
new posts

  • PowerShell & System DBs

    So if you open PowerShell (SSMS > Right Click instance name > Start PowerShell)

    I then cd into Databases and dir, it does not list the system databases. Open up SSMS again and right click on "System Databases" in Object Explorer, no "Start PowerShell". So I go under that and right click on "master" and there is a "Start Powershell".

    But, I can go into at the prompt:
    PS SQLSERVER:\sql\servername\default\Databases\ and cd to master, but if I'm only in Databases I cannot dir to get info on each database.

    Now the questions:
    -Is this as designed? Does Microsoft "hide" those from the list, similar to system files for the reason they don't want you to "accidentally" do something?

    -What would that prevent me from doing script wise (not that I have written any of yet)?

    Window Server 2003, SQL Server 2008 Ent, but only PowerShell v1.

    Apologies to Sean McCown, I have not watched all of your PowerShell videos yet so I don't know if you may address this in one of those

  • #2
    Re: PowerShell & System DBs

    I honestly can't remember if it's the same on v.1, but here's my blog on how to do this in v.2... actually, this is a slightly different issue (I just read the post again)...

    So for your purposes, in the 'databases' root, you should be able to see the system DBs like this:
    > dir -force

    Take care.
    Sean McCown, SQL Server MVP

    See my FREE SQL Server training videos at:

    Blog Author of:
    Database Underground --
    DBA Rant