Powershell for SQL

SQL Server Management Objects (SMO)

SMO is a collection of objects that are designed for programming all aspects of managing Microsoft SQL Server. SQL Server Replication Management Objects (RMO) is a collection of objects that encapsulates SQL Server replication management.

SQL Server Management Objects (SMO) are objects designed for programmatic management of Microsoft SQL Server. You can use SMO to build customized SQL Server management applications. Although SQL Server Management Studio is a powerful and extensive application for managing SQL Server, there might be times when you would be better served by an SMO application.

The SMO object model extends and supersedes the Distributed Management Objects (SQL-DMO) object model. Compared to SQL-DMO, SMO increases performance, control, and ease of use. Most SQL-DMO functionality is included in SMO, and there are various new classes that support new features in SQL Server.

Because SMO is compatible with SQL Server 2000, SQL Server 2005, SQL Server 2008 and SQL Server 2008 R2, you can easily manage a multi-version environment. But SMO does not support compatibility level 60, 65 or 70. If you use SMO with a database set to compatibility level 60, 65 or 70, you will not be able to manage the database by using SMO.

The SMO namespace is Microsoft.SqlServer.Management.Smo. SMO is implemented as a Microsoft .NET Framework assembly. This means that the common language runtime from the Microsoft .NET Framework version 2.0 must be installed before using the SMO objects. The SMO assemblies are installed by default into the Global Assembly Cache (GAC) with the SQL Server SDK option. The assemblies are located in C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\.

Sarabpreet Singh Anand