'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Reference the AdventureWorks2008R2 database.
Dim db As Database
db = srv.Databases("AdventureWorks2008R2")
'Display all the schemas in the database.
Dim sc As Schema
For Each sc In db.Schemas
Console.WriteLine(sc.Name)
Next