locked
Cannot find type [Microsoft.SqlServer.Management.Smo.Server] RRS feed

  • Question

  • Just imported SQL2016 MP 7.0.0.0 and are getting an error on our Always On Discovery.

    Can't find any post with the same error and can't seem to find out wy this is happening.

    It does find a couple of paths in the registry so that isn't it.
    And in one of the paths there are the Psprovider and PSSnapin files that i guess it is looking for.

    So anybody know why the Discovery isn't working ?

    DatabaseReplicaAlwaysOnDiscovery.ps1 Version: 7.0.0.0 : Error occurred during Always On Database Replica Discovery.

    Reason: Cannot find type [Microsoft.SqlServer.Management.Smo.Server]: verify that the assembly containing this type is loaded. Position:82 Offset:13 Instance:MSSQLSERVER Detailed error output: Cannot find type [Microsoft.SqlServer.Management.Smo.Server]: verify that the assembly containing this type is loaded. -------- Cannot find path 'HKLM:\Software\Wow6432Node\Microsoft\Microsoft SQL Server\110\Tools\ClientSetup\' because it does not exist. -------- Cannot find path 'HKLM:\Software\Microsoft\Microsoft SQL Server\110\Tools\ClientSetup\' because it does not exist. -------- Cannot find path 'HKLM:\Software\Wow6432Node\Microsoft\Microsoft SQL Server\120\Tools\ClientSetup\' because it does not exist. -------- Cannot find path 'HKLM:\Software\Microsoft\Microsoft SQL Server\120\Tools\ClientSetup\' because it does not exist. -------- Cannot find path 'HKLM:\Software\Microsoft\Microsoft SQL Server\140\Tools\ClientSetup\' because it does not exist.



    • Edited by Patrik_Hansson Thursday, November 23, 2017 8:19 AM Spelling
    Thursday, November 23, 2017 8:18 AM

Answers

  • Hi All,

    The guys have developed a fix for this bug. As per Alex you can request the fix by contacting them at sqlmpsfeedback@microsoft.com

    Here the reference thread:

    SQL 2016 MP 7.0.0 - Always On Database Replica discovery

    The fix is production ready and my test so far can confirm this. 

    Don't forget to provide your feedback to the guys, developing the fix, they need it to make the product better for us. 

    Thanks and Regards,


    Stoyan (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Friday, January 5, 2018 10:13 AM

All replies

  • Hi Patrik,

    allow me to ignore the content of the error message and ask if you have made the recommended configurations (WMI, DCOM) regarding AlwaysON Monitorng and Discovery?  They are found in the MP Guide and are related to AlwaysON in particular.

    Can you please verify the permissions are set up properly. Thanks,


    Stoyan (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Thursday, November 23, 2017 1:22 PM
  • Hi,

    SQL Server Management Studio should be installed on the machine where Operations Console is installed to provide the capability to invoke SQL PowerShell tasks from Operations Console.

    Could you please check if that has been done  ?

    Best Regards,

    Elton


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    • Edited by Elton_Ji Monday, November 27, 2017 4:41 AM
    Monday, November 27, 2017 4:40 AM
  • Hello. I also had this problem. I tried everything: manual running of discovery scripts (they are working), added to registry absent paths, added loading of "Microsoft.SqlServer.Management.Smo.Server" module to my Action Accout Powershell profile. But the only thing "resolution" was rollback all "Always On" MP's to version 6.7.31.0 (I think, that rollback only Always On Discovery MP's also working).
    Monday, November 27, 2017 10:01 AM
  • Hi Patrik,

    allow me to ignore the content of the error message and ask if you have made the recommended configurations (WMI, DCOM) regarding AlwaysON Monitorng and Discovery?  They are found in the MP Guide and are related to AlwaysON in particular.

    Can you please verify the permissions are set up properly. Thanks,


    Stoyan (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Will look into that. But shouldn't the error message be something else if that were the case.
    Tuesday, November 28, 2017 8:01 AM
  • Hi,

    SQL Server Management Studio should be installed on the machine where Operations Console is installed to provide the capability to invoke SQL PowerShell tasks from Operations Console.

    Could you please check if that has been done  ?


    What? I'm not invoking commands from the console, the agent on the SQL server is trying to run a PS1 to monitor. And on the Server SSMS is installed.
    Tuesday, November 28, 2017 8:07 AM
  • Hi Patrik,

    allow me to ignore the content of the error message and ask if you have made the recommended configurations (WMI, DCOM) regarding AlwaysON Monitorng and Discovery?  They are found in the MP Guide and are related to AlwaysON in particular.

    Can you please verify the permissions are set up properly. Thanks,


    Stoyan (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Ok, have gotten confirmation that the config from page28 and forward in the MP Guide have been set.
    Tuesday, November 28, 2017 11:52 AM
  • I can see that there are some changes in Tools detection between 6.7.31.0 and 7.0.0.0

    in 6.7.31.0 it was hardcoded to 130

    function ImportModuleActionSqlModules($arAssemblies){
    	$paths = @( 
    		(get-itemproperty -path 'hklm:\Software\Microsoft\Microsoft SQL Server\130\Tools\ClientSetup\' | Select SQLPath).SQLPath ,
    		(get-itemproperty -path 'hklm:\Software\Wow6432Node\Microsoft\Microsoft SQL Server\130\Tools\ClientSetup\' | Select SQLPath).SQLPath )
    	
    	if (!(ImportSQLModules $arAssemblies $paths '130\Tools'))	{
    	    Import-Module SQLPS -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Out-Null
    	    if(!(IsModuleLoaded 'SQLPS'))
    	    {
    	        throw 'Unable to load SQLPS modules'
    	    }
    	}

    In 7.0.0.0 its more dynamicly located

    function ImportModuleActionSqlModules($arAssemblies){
    	$paths = GetSqlToolsPaths
    		
     
    	if (!(ImportSQLModules $arAssemblies $paths))	{
    	    Import-Module SQLPS -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Out-Null
    	    if(!(IsModuleLoaded 'SQLPS'))
    	    {
    	        throw 'Unable to load SQLPS modules'
    	    }
    	}
    }
    
    function GetSqlToolsPaths(){
    	$pathVersions = @('130','140','120','110')
    	$pathTemplates = @('HKLM:\Software\Microsoft\Microsoft SQL Server\{0}\Tools\ClientSetup\',
    					   'HKLM:\Software\Wow6432Node\Microsoft\Microsoft SQL Server\{0}\Tools\ClientSetup\')
    	$includeTemplate = '{0}\Tools'
    	$paths = @()
    	
    	foreach($version in $pathVersions){
    		$checkInclude = $includeTemplate -f $version
    		foreach($template in $pathTemplates){
    			$path = $template -f $version
    			$sqlPathObj = Get-ItemProperty -Path $path -Name 'SQLPath' -ErrorAction SilentlyContinue
    			if($sqlPathObj -ne $null){
    				$sqlPath = $sqlPathObj.SQLPath
    				if(![string]::IsNullOrEmpty($sqlPath) -and $sqlPath.Contains($checkInclude)){
    					$paths += $sqlPath
    				}
    			}
    		}
    	}
    	return $paths

    Tuesday, November 28, 2017 12:52 PM
  • I have the same error messages!

    As it seems I have them for the 120, 130 and 140 instances. I looked up all the paths in the registry and they don't exist. 

    Event ID: 7103. Management Group: ***. Script: ModuleAction Module: GeneralAlwaysOnDiscovery.ps1 Version: 7.0.0.0 : Error occurred during Always On discovery.
    Computer: ***
    Reason: Cannot find any service with service name 'ClusSvc'. 
    Position:63 
    Offset:7 
    Instance:MSSQLSERVER
    Detailed error output: Cannot find any service with service name 'ClusSvc'.
    --------
    Cannot find path 'HKLM:\Software\Wow6432Node\Microsoft\Microsoft SQL Server\120\Tools\ClientSetup\' because it does not exist.
    --------
    Cannot find path 'HKLM:\Software\Microsoft\Microsoft SQL Server\120\Tools\ClientSetup\' because it does not exist.
    --------
    Cannot find path 'HKLM:\Software\Wow6432Node\Microsoft\Microsoft SQL Server\140\Tools\ClientSetup\' because it does not exist.
    --------
    Cannot find path 'HKLM:\Software\Microsoft\Microsoft SQL Server\140\Tools\ClientSetup\' because it does not exist.
    --------
    Cannot find path 'HKLM:\Software\Wow6432Node\Microsoft\Microsoft SQL Server\130\Tools\ClientSetup\' because it does not exist.
    --------
    Cannot find path 'HKLM:\Software\Microsoft\Microsoft SQL Server\130\Tools\ClientSetup\' because it does not exist.

    Wednesday, November 29, 2017 8:19 AM
  • No you don't have the same error, yours is that it can't find the cluster service.

    Please check if you might have a 110 path as it outputs the ones it can't find even if it finds Another one working.

    And create a new thread :)

    Wednesday, November 29, 2017 8:36 AM
  • Yes, I have 110 path. Not sure why it is erroring about the other ones.

    And I don't have a Cluster Service running (nor the feature enabled) so also not sure why is searching for that.

    Wednesday, November 29, 2017 9:02 AM
  • Hi Roel, did you create a new thread for this problem? If not, please email us at sqlmpsfeedback@microsoft.com with details of the problem. Or share a link to the new thread at TechNet, if you already created it.

    Wednesday, December 6, 2017 1:30 PM
  • Hi Roel, did you create a new thread for this problem? If not, please email us at sqlmpsfeedback@microsoft.com with details of the problem. Or share a link to the new thread at TechNet, if you already created it.


    Hi Alex, I think you should include the dll as part of management pack bundle in next version of MP or use standard C# classes in discovery rules.

    Vladimir Zelenov | http://systemcenter4all.wordpress.com

    Friday, January 5, 2018 9:37 AM
  • As fast resolution you can install SQL Server Management Studio on the problem server.

    Vladimir Zelenov | http://systemcenter4all.wordpress.com

    Friday, January 5, 2018 9:51 AM
  • Hi All,

    The guys have developed a fix for this bug. As per Alex you can request the fix by contacting them at sqlmpsfeedback@microsoft.com

    Here the reference thread:

    SQL 2016 MP 7.0.0 - Always On Database Replica discovery

    The fix is production ready and my test so far can confirm this. 

    Don't forget to provide your feedback to the guys, developing the fix, they need it to make the product better for us. 

    Thanks and Regards,


    Stoyan (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Friday, January 5, 2018 10:13 AM
  • Hi everyone! We've publicly released SQL MPs 7.0.2.0 where introduced a few fixes together with the fix for "Cannot find type" error. You'll find links to the new version here: https://blogs.msdn.microsoft.com/sqlreleaseservices/released-system-center-management-packs-for-sql-server-2008-2016-7-0-2-0/.

    As always, we'll be happy to hear from you. The fastest ways to reach us is to either leave a comment on the release blog post or send an email at sqlmpsfeedback@microsoft.com.

    Monday, February 5, 2018 12:36 PM