Bobcares

Powershell Cannot Find Type microsoft.sqlserver.management.smo.server

by | Jun 27, 2022

Powershell Cannot find type microsoft.sqlserver.management.smo.server error troubleshooting methods by our Bobcare’s specialist team.

At Bobcares, as part of our Microsoft SQL Server Support service, we respond to every question from the customers.

Let’s have a closer look at various troubleshooting methods for the error by our experts.

Powershell cannot find type Microsoft.SqlServer.Management.Smo.Server Error

When customers attempt to run a fast Server backup using a PowerShell script to backup databases, sometimes the following error may appear:

PS>TerminatingError(New-Object): “Cannot find type [Microsoft.SqlServer.Management.Smo.Server]: verify that assembly containing this type is loaded.”
new-object : Cannot find type [Microsoft.SqlServer.Management.Smo.Server]: verify that  assembly containing this type is loaded.

Our Support team looked into this error. They came up with a few ways to troubleshoot the error for our customers. Now let’s examine them closely.

We have found that there is a need to install extensions for PowerShell to be able to run this script. So we must install the compatible PowerShell Extensions for our SQL Server. For instance, if we have SQL Server 2016 as a target server, we need PowerShell Extensions for SQL Server 2016.

Troubleshooting the error

SqlServer and SQLPS are two SQL Server PowerShell modules. The SQLPS module comes pre-installed with SQL Server. However, it is no longer updated. The SqlServermodule is the most recent PowerShell module. The SqlServer module includes new cmdlets to support the latest SQL capabilities. It also includes updated versions of the SQLPS cmdlets.

Now we can see how Bobcares support team suggests a customer with SQL Server 2016 as a target server to fix this issue.

  • Firstly, install SQLSysClrTypes.msi – Microsoft System CLR Types for Microsoft SQL Server 2016.
  • Then install SharedManagementObjects.msi – Microsoft SQL Server 2016 Shared Management Objects.
  • Lastly, install PowerShellTools.msi – Microsoft Windows PowerShell Extensions for Microsoft SQL Server 2016.

Once we install all the components, then we can check it with the command;

Get-Module -ListAvailable -Name SQLPS

Here is another solution provided by our techs to the customer for the below error.

new-object : Cannot find type [Microsoft.SqlServer.Management.Smo.Server]: verify that assembly containing this
type is loaded.
At line:1 char:6
+ $s = new-object ('Microsoft.SqlServer.Management.Smo.Server') 'sqlnod ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId :
TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

Now we can see how our server management team help the client to fix this issue. The steps are:

  • Start a PowerShell session. Then use the following instructions to install the SqlServer module from the PowerShell Gallery.

Install-Module -Name SqlServer

  • If there are previous versions of the SqlServer module on the computer, then we can use Update-Module or provide the -AllowClobber parameter:

Install-Module -Name SqlServer -AllowClobber

  • If we are unable to run the PowerShell session as admin, we can install for the current user:

Install-Module -Name SqlServer -Scope CurrentUser

  • Using Update-Module, we can upgrade the SqlServer module versions:

Update-Module -Name SqlServer

  • To see the installed module versions:

Get-Module SqlServer -ListAvailable

  • To utilize a particular version of the module, import it with a version number. For e.g.,

Import-Module SqlServer -Version Version_number

With these solutions, we can definitely fix the error for our customers.

[Looking for a solution to another query? We are just a click away.]

Conclusion

When doing a quick server backup, some users could get the following error: cannot find type microsoft.sqlserver.management.smo.server. Here, our Support Team keenly look into the issue and developed troubleshooting techniques to address the issue easily.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF