Loading SMO assemblies
Before you can use the SMO library, the assemblies need to be loaded. With the introduction of the SQLPS module, this step is easier than ever.
In this recipe, we assume you have already installed SMO on your machine.
How to do it...
To load SMO assemblies via the SQLPS module, perform the following steps:
- Open up your PowerShell console, PowerShell ISE, or your favorite PowerShell Editor.
- Type the import-module command as follows:
- Confirm that the module is loaded by running the following. This should give the name of the module if it is loaded:
How it works...
The way to load SMO assemblies has changed between different versions of PowerShell and SQL Server. Before the SQLPS module and ...