Home Forums Programming SMO/RMO/DMO Got a newbie SMO powershell question/issue. RE: Got a newbie SMO powershell question/issue.

  • This may obvious to most, but I worked this out in the end, I had to register the assemblies, for anyone else that may come across this, you install the SDK off the SQL Server media and then navigate to the SDK folder and find your assemblies (.dll) and register them in PowerShell

    Example: (you path may be different, I just registered everything I thought I might need)

    Add-Type -Path 'C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.sqlEnum.dll'

    Add-Type -Path 'C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.wmiEnum.dll'

    Add-Type -Path 'C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServerEnum.dll'

    Add-Type -Path 'C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.SmoExtended.dll'

    Add-Type -Path 'C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll'

    Add-Type -Path 'C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.SqlWmiManagement.dll'

    How to register SQL server assemblies in PowerShell

    Regards,

    D