# I like to use SMO. There are other ways, arguably just as good.
# You need to make sure that the SMO library is loaded.
# If it already is loaded, you don't need this line.
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null
# I'm using integrated security.
# If you aren't, you will need to add a username and password here.
# substitute your server name in place of localhost
$server = New-Object ([Microsoft.SQLServer.Management.SMO.Server]) "localhost"
# Substitute your database name in place of
AdventureWorks $Database = $server.Databases | where {$_.Name -match "AdventureWorks"}
$Database.Schemas | Format-Table Name
# if you want to see schemas in all databases in one list, this should work
$server.Databases.Schemas | format-table Parent,Name