-
Book Overview & Buying
-
Table Of Contents
SQL Server 2014 with Powershell v5 Cookbook
By :
SQL Server Management Objects (SMO) was introduced with SQL Server 2005 to allow SQL Server to be accessed and managed programmatically. SMO can be used in any .NET language, including C#, VB.NET, and PowerShell. Since SQL Server does not ship with many cmdlets, SMO is the key to automating most SQL Server tasks. SMO is also backwards compatible with previous versions of SQL Server, extending support all the way to SQL Server 2000.
SMO comprises two distinct classes: the Instance classes and the Utility classes.
The Instance classes are the SQL Server objects. Properties of objects such as the server, databases, and tables can be accessed and managed using the instance classes.
The Utility classes are helper or utility classes that accomplish common SQL Server tasks. These classes belong to one of four groups: Transfer, Backup, and Restore classes, or the Scripter class.
To gain access to the SMO libraries, SMO needs to be installed and the SQL Server-related assemblies need to be loaded.
There are a few ways to install SMO:
If you are installing SQL Server or already have SQL Server, perform the following steps:
setup.exe file.
After this, you should already have all the binaries needed to use SMO.
If you are not installing SQL Server, you must install SMO using the SQL Server Feature Pack on the machine you are using SMO with. The steps are as follows:
SharedManagementObjects.msi to install.By default, the SMO assemblies in SQL Server 2014 will be installed in <SQL Server Install Directory>\120\SDK\Assemblies. This is shown in the following screenshot:
