user2095050
user2095050

Reputation: 23

Powershell sql provider databases collection missing system databases

When connecting to the powershell sql provider on 2008R2 the Databases collection does not seem to include the system databases. Any ideas how to include master, msdb, etc. in the returned list ? Using SMO does it, I was just curious how to do it with the provider.

E.g

push-location "SQLSERVER:\SQL\$env:COMPUTERNAME\DEFAULT\Databases" 
Get-ChildItem | Select-Object Name 
Pop-Location

Returns:

Name    
----
DBA   

Upvotes: 2

Views: 188

Answers (1)

CB.
CB.

Reputation: 60918

this way:

push-location "SQLSERVER:\SQL\$env:COMPUTERNAME\DEFAULT\Databases" 
Get-ChildItem -force | Select-Object Name 
Pop-Location

Upvotes: 3

Related Questions