Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlAG : Creating an AG fails #812

Closed
MakwaWes opened this issue Sep 13, 2017 · 36 comments
Closed

SqlAG : Creating an AG fails #812

MakwaWes opened this issue Sep 13, 2017 · 36 comments
Labels
stale The issue or pull request was marked as stale because there hasn't been activity from the community.

Comments

@MakwaWes
Copy link

Details of the scenario you tried and the problem that is occurring:
Deploying a new AOAG on a SQL Server 2016 fails with the following error :
PowerShell DSC resource MSFT_xSQLServerAlwaysOnAvailabilityGroup failed to execute Set-TargetResource functionality with error message: Creating the availability group 'CustomAGName'. InnerException: Cannot bind parameter 'InputObject'. Cannot convert the "[SQLServer\CustomInstanceName]" value of type "Microsoft.SqlServer.Management.Smo.Server" to type "Microsoft.SqlServer.Management.Smo.Server".

It worked after I edited the resource "MSFT_xSQLServerAlwaysOnAvailabilityGroup.psm1" on the server.
Line 369
Original : "InputObject = $serverObject"
Updated (and working) : "InputObject = $serverObject.Name"

The DSC configuration that is using the resource (as detailed as possible):
Nothing fancy, pretty much as in the example of the resource.

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
Windows Server 2016 Core
SQL Server 2016 Enterprise Core
PSVersion 5.1.14393.1198

What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
SQLServer 21.0.17178

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
xSQLServer 8.1.0.0 (also tried with dev)

Thank you,
Wesley

@johlju
Copy link
Member

johlju commented Sep 15, 2017

Have you tried with Dev since I merged issue #649 (PR #800)? If not, please test with the latest Dev branch. If you are actually using the code as of today then this is interesting.

@johlju johlju added the question The issue is a question. label Sep 15, 2017
@MakwaWes
Copy link
Author

Hi,
I tried using the latest Dev branch and have the same issue. I made sure the LCM is in the "ForceModuleimport" debug mode. I can also tell you that the listener resource is having the same issue where the InputObject isn't properly converted.

@randomnote1
Copy link
Contributor

That seems odd. The New-SqlAvailabilityGroup cmdlet accepts a server object for the InputObject parameter. Example

Looking at the cmdlet in the SQLServer module, it looks like the functionality hasn't changed from SQLPS:

C:\> ( Get-Command -Module sqlserver -Name New-SqlAvailabilityGroup )

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          New-SqlAvailabilityGroup                           21.0.17178 sqlserver


C:\> ( Get-Command -Module sqlserver -Name New-SqlAvailabilityGroup ).Parameters.InputObject.ParameterType

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     False    Server                                   Microsoft.SqlServer.Management.Smo.SqlSmoObject

@johlju
Copy link
Member

johlju commented Sep 21, 2017

It must be something with the wrong assembly being loaded.

@MakwaWes can you do this just to get a bit more information.

  1. Could you run Get-Module *sql* -ListAvailable and post the result.
  2. Could you post the configuration you are using? I'm in particular looking for what xSQLServer resource you are using and the order they are used. I looking for if there is one that wrongly loads the assembly using 'LoadWithPartial' which could trigger this behavior (it loads the first assembly in the list regardless, see issue xSQLServerAlwaysOnAvailabilityGroup: SqlServer Module v21.0.17099 breaks the resource #649).

@MakwaWes
Copy link
Author

I had to progress in my work so I removed the module "SqlServer" from the machine and it's working flawlessly since. Unfortunately, I can't answer completely your questions but I'll try.

  1. Here's the modules installed locally on the server :
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   8.1.0.0    xSQLServer
Manifest   1.0        SQLPS

It used to also have the module "SqlServer" v21.0.17152 before I removed it.

  1. I can't give you my config data but here's the order in which I call the resources :
  • Misc. OS setup using xPSDesiredStateConfiguration v7.0.0.0
  • Clustering setup using xFailOverCluster v1.8.0.0
  • SQL installation & config using xSQLServer v8.1.0.0
    1. xSQLServerSetup
    2. xSQLServerNetwork
    3. xSQLServerMemory
    4. xSQLServerMaxDop
    5. xSQLServerConfiguration
    6. xSQLServerAlwaysOnService
    7. xSQLServerEndpoint
    8. xSQLServerEndpointState
    9. xSQLServerAlwaysOnAvailabilityGroup
    10. xWaitForAvailabilityGroup
    11. xSQLServerAlwaysOnAvailabilityGroupReplica
    12. xSQLServerAvailabilityGroupListener

I hope this helps.

@randomnote1
Copy link
Contributor

@MakwaWes, did you have SQL Server Management Studio installed on the box?

@MakwaWes
Copy link
Author

No, as described in the issue, the server OS is a Windows Core therefore we don't deploy any GUI stuff on it.

@randomnote1
Copy link
Contributor

Oops, missed that. 😕 Thanks!

@johlju johlju changed the title xSQLServerAlwaysOnAvailabilityGroup : Creating an AG fails SqlAG : Creating an AG fails Dec 23, 2017
@johlju
Copy link
Member

johlju commented Jan 5, 2018

@MakwaWes Can you please confirm that this is still a problem with SqlServerDsc v10?

@dcrreynolds
Copy link
Contributor

dcrreynolds commented Feb 8, 2018

I can confirm that this does occur in v10. I replaced line 335 in MSFT_SqlServerEndpoint.psm1 with the below and it worked fine for me.

InputObject         = (Get-Item "SQLSERVER:\SQL\$ServerName\$InstanceName")

If this is an acceptable fix, I will send you a PR for it.

@johlju
Copy link
Member

johlju commented Feb 8, 2018

@dcrreynolds Did you confirm this when using SqlServer module? If so, I think we need to confirm that the change works for SQLPS as well so we don't break that.

@dcrreynolds
Copy link
Contributor

According to Get-Module -ListAvailable, SQLPS is the only relevant module I have.

@claudiospizzi
Copy link
Contributor

claudiospizzi commented Feb 13, 2018

I've exactly the same issue. I've replaced the same line 335 as @dcrreynolds, but in the MSFT_SqlAG.psm1 file. On my system, SSMS 17.4 is installed. The only relevant SQL module is SQLPS.

By the way, exactly the same issue on MSFT_SqlAGListener:
Cannot bind parameter 'InputObject'. Cannot convert the "[AVGGROUP01]" value of type "Microsoft.SqlServer.Management.Smo.AvailabilityGroup" to type
"Microsoft.SqlServer.Management.Smo.AvailabilityGroup".

And on MSFT_SqlAGReplica:
Creating the Availability Group Replica 'SERVER01\INSTANCE01' failed on the
instance 'INSTANCE01'. InnerException: Cannot bind parameter 'InputObject'. Cannot convert the "[AVGGROUP01]" value of type "Microsoft.SqlServer.Management.Smo.AvailabilityGroup" to type
"Microsoft.SqlServer.Management.Smo.AvailabilityGroup".

I think we have a general problem with all AG resources and PowerShell modules.

@dcrreynolds
Copy link
Contributor

@claudiospizzi I've run into the same issues with MSFT_SqlAGListener and MSFT_SqlAGReplica now too.

@johlju
Copy link
Member

johlju commented Feb 15, 2018

Update: Update the text a bit.

Hmm.. Before this was a problem when the wrong version of the SMO library was loaded. 🤔 We had the same problem before in the closed issue #649 and I thought we solved it.

@claudiospizzi and @dcrreynolds do you both have SSMS 17.x installed?

I'm thinking that both the old and the new assemblies are in the session, but it loads (finds) the new SqlServer assemblies first and then when a cmdlet from SQLPS is used which needs the old assemblies, it breaks, because the new assemblies does not work with SQLPS.

On the target node that's falling, can you both please add this row

[System.AppDomain]::CurrentDomain.GetAssemblies() | ? Location -like *SqlServer* | % { Write-Verbose ("GAC:{0}`t`tVersion:{1}`t`tLocation:{2}" -f $_.GlobalAssemblyCache,$_.ImageRuntimeVersion,$_.Location) -Verbose }

After the following row.

https://github.com/PowerShell/SqlServerDsc/blob/a8cb7528153eb7d7246a41b97c7a28b831686ac5/DSCResources/MSFT_SqlAGListener/MSFT_SqlAGListener.psm1#L487

Please run the configuration again with verbose output, and hopefully this will output verbose messages and list all the loaded assemblies in the session.
I'm hoping this will shed some light on this.

@DaniSQL
Copy link

DaniSQL commented Feb 22, 2018

I am hitting similar error when trying to create AG. I have tried replacing the line
InputObject = $serverObject
with both the following as recommended above and it did not help.

InputObject = $serverObject.Name

InputObject         = (Get-Item "SQLSERVER:\SQL\$ServerName\$InstanceName")

Environment xSQLServer module, Version 9.0 , SQL Server 2016, SSMS 17.4 already installed

PowerShell DSC resource MSFT_xSQLServerAlwaysOnAvailabilityGroup  failed to execute Set-TargetResource 
functionality with error message: Creating the availability group 'TestAG'. InnerException: Cannot bind 
parameter 'InputObject'. Cannot convert the "[serverA\SQL1]" value of type 
"Microsoft.SqlServer.Management.Smo.Server" to type "Microsoft.SqlServer.Management.Smo.Server". 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : ServerA 

I appreciate any pointers to workaround through this error.

@claudiospizzi
Copy link
Contributor

@johlju
Yes, I have SSMS 17.5 installed.

Here the GAC output of my lab environment:

VERBOSE: [VSLABSQL01]: LCM:  [ Start  Resource ]  [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener]
VERBOSE: [VSLABSQL01]: LCM:  [ Start  Test     ]  [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener]
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] 2018-02-27_13-18-50: Testing state of listener VSLABAVG01
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Information: PowerShell module SqlServer not found, trying to use older SQLPS module.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Importing PowerShell module SQLPS.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Connected to SQL instance 'VSLABSQL01\INST01'.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Dmf\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Dmf.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlWmiManagement\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ConnectionInfo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SmoExtended\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.RegisteredServers\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.RegisteredServers.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Sdk.Sfc\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.RegSvrEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.RegSvrEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.WmiEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.WmiEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ServiceBrokerEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ServiceBrokerEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Collector\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Collector.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.CollectorEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.CollectorEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Utility\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Utility.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.UtilityEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.UtilityEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.HadrDMF\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.HadrDMF.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:False  Version:v4.0.30319  Location:C:\Program Files (x86)\Microsoft SQL
Server\130\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSSnapins.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ConnectionInfo\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SmoExtended\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Sdk.Sfc\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlWmiManagement\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlEnum\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Dmf\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Dmf.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:False  Version:v2.0.50727  Location:C:\Program Files (x86)\Microsoft SQL
Server\130\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSProvider.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlClrProvider\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlClrProvider.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Diagnostics.STrace\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Diagnostics.STrace.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] 2018-02-27_13-18-50: Listener VSLABAVG01 does not exist
VERBOSE: [VSLABSQL01]: LCM:  [ End    Test     ]  [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener]  in 0.3440 seconds.
VERBOSE: [VSLABSQL01]: LCM:  [ Start  Set      ]  [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener]
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Information: PowerShell module SqlServer not found, trying to use older SQLPS module.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Importing PowerShell module SQLPS.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Information: PowerShell module SqlServer not found, trying to use older SQLPS module.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Importing PowerShell module SQLPS.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Connected to SQL instance 'VSLABSQL01\INST01'.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Dmf\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Dmf.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlWmiManagement\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ConnectionInfo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SmoExtended\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.RegisteredServers\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.RegisteredServers.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Sdk.Sfc\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.RegSvrEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.RegSvrEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.WmiEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.WmiEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ServiceBrokerEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ServiceBrokerEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Collector\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Collector.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.CollectorEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.CollectorEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Utility\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Utility.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.UtilityEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.UtilityEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.HadrDMF\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.HadrDMF.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:False  Version:v4.0.30319  Location:C:\Program Files (x86)\Microsoft SQL
Server\130\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSSnapins.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ConnectionInfo\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SmoExtended\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Sdk.Sfc\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlWmiManagement\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlEnum\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Dmf\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Dmf.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:False  Version:v2.0.50727  Location:C:\Program Files (x86)\Microsoft SQL
Server\130\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSProvider.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlClrProvider\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlClrProvider.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Diagnostics.STrace\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Diagnostics.STrace.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] 2018-02-27_13-18-51: Listener VSLABAVG01 does not exist
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] 2018-02-27_13-18-51: Create listener on VSLABAVG01
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Information: PowerShell module SqlServer not found, trying to use older SQLPS module.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Importing PowerShell module SQLPS.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] Connected to SQL instance 'VSLABSQL01\INST01'.
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Dmf\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Dmf.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlWmiManagement\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ConnectionInfo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SmoExtended\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.RegisteredServers\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.RegisteredServers.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Sdk.Sfc\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.RegSvrEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.RegSvrEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.WmiEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.WmiEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ServiceBrokerEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ServiceBrokerEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Collector\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Collector.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.CollectorEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.CollectorEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Utility\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Utility.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.UtilityEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.UtilityEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.HadrDMF\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.HadrDMF.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:False  Version:v4.0.30319  Location:C:\Program Files (x86)\Microsoft SQL
Server\130\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSSnapins.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ConnectionInfo\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SmoExtended\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Sdk.Sfc\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlWmiManagement\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlEnum\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Dmf\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Dmf.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:False  Version:v2.0.50727  Location:C:\Program Files (x86)\Microsoft SQL
Server\130\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSProvider.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlClrProvider\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlClrProvider.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] GAC:True  Version:v2.0.50727
Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Diagnostics.STrace\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Diagnostics.STrace.dll
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] 2018-02-27_13-18-51: Listener port set to 1433
VERBOSE: [VSLABSQL01]:                            [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener] 2018-02-27_13-18-51: Listener set to static IP-address(es); 192.168.144.36/255.255.255.0
Cannot bind parameter 'InputObject'. Cannot convert the "[VSLABAVG01]" value of type "Microsoft.SqlServer.Management.Smo.AvailabilityGroup" to type
"Microsoft.SqlServer.Management.Smo.AvailabilityGroup".
    + CategoryInfo          : InvalidArgument: (:) [], CimException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.SqlServer.Management.PowerShell.Hadr.NewSqlAvailabilityGroupListenerCommand
    + PSComputerName        : VSLABSQL01.lab.local

VERBOSE: [VSLABSQL01]: LCM:  [ End    Set      ]  [[SqlAGListener]SQL-INST01-VSLABAVG01-Listener]  in 1.0310 seconds.
The PowerShell DSC resource '[SqlAGListener]SQL-INST01-VSLABAVG01-Listener' with SourceInfo
'C:\Users\Claudio\Workspace\Arcade\PSArcadeDsc\Configurations\Configurations\SqlServer.ps1::640::29::SqlAGListener' threw one or more non-terminating errors while running the Set-TargetResource
functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : VSLABSQL01.lab.local

@DaniSQL
Copy link

DaniSQL commented Feb 28, 2018

UPDATE: Using SQLServer module solved the issue.

@brwilkinson
Copy link

This issues seems to persist in the new SQLSERVER Module.
21.0.17224 SqlServer

However the issue is resolved in the following (Earlier) version of the module.
21.0.17199 SqlServer

@smastrorocco
Copy link

Any update on this? Running into this issue with SqlAG on v11.2 of the module

@johlju
Copy link
Member

johlju commented Jun 4, 2018

@claudiospizzi Seemed you got two version of Microsoft.SqlServer.Smo.dll loaded into the session. This can be the reason.

C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll

@johlju
Copy link
Member

johlju commented Jun 4, 2018

@brwilkinson @smastrorocco Can you please do a run on the target and output the verbose output after you added the row mentioned in this #812 (comment).
Also please post the output of Get-Module *sql* -ListAvailable.

Looking for a combination of assemblies and modules that make this problem happen.

@johlju johlju added needs more information The issue needs more information from the author or the community. and removed question The issue is a question. labels Jun 4, 2018
@smastrorocco
Copy link

smastrorocco commented Jun 5, 2018

@johlju We're executing the resource through Chef, here is the error from the DSC resource

***EDIT: I just noticed your comment about adding the verbose output with the additional line. I'm adding that now and will leave another reply with it.

Error executing action `run` on resource 'dsc_resource[<MY-AG>]'
================================================================================
Chef::Exceptions::PowershellCmdletException
-------------------------------------------
Powershell Cmdlet failed: PowerShell DSC resource MSFT_<MY-AG>  failed to execute Set-TargetResource
functionality with error message: Creating the availability group '<MY-AG>'.
InnerException: Cannot bind parameter 'InputObject'. Cannot convert the
"[<MY-SERVER>]" value of type "Microsoft.SqlServer.Management.Smo.Server" to
type "Microsoft.SqlServer.Management.Smo.Server".

Here's the PS modules loaded:

    Directory: C:\Program Files\WindowsPowerShell\Modules
	
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   11.2.0.0   SqlServerDsc

    Directory: C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules
	
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.0        SQLASCMDLETS                        {Add-RoleMember, Backup-ASDatabase, Invoke-ASCmd, Invoke-P...
Manifest   1.0        SQLPS                               {Backup-SqlDatabase, Add-SqlAvailabilityDatabase, Add-SqlA...

@stale stale bot removed the needs more information The issue needs more information from the author or the community. label Jun 5, 2018
@smastrorocco
Copy link

@johlju Sorry for the delay:

VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Dmf\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Dmf.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlWmiManagement\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ConnectionInfo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SmoExtended\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.RegisteredServers\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.RegisteredServers.dll                                                                    
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Sdk.Sfc\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.RegSvrEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.RegSvrEnum.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.WmiEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.WmiEnum.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ServiceBrokerEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ServiceBrokerEnum.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Collector\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Collector.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.CollectorEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.CollectorEnum.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Utility\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Utility.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.UtilityEnum\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.UtilityEnum.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.HadrDMF\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.HadrDMF.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:False  Version:v2.0.50727   Location:C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSSnapins.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.ConnectionInfo\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SmoExtended\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Sdk.Sfc\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlWmiManagement\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlEnum\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Dmf\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Dmf.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:False  Version:v2.0.50727   Location:C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSProvider.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.WmiEnum\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.WmiEnum.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlClrProvider\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlClrProvider.dll
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlClrProvider\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlClrProvider.dll

VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] Information: PowerShell module SqlServer not found, trying to use older SQLPS module.
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] Importing PowerShell module SQLPS.
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] Connected to SQL instance '<MY-SERVER>'.
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] The cluster login 'NT AUTHORITY\SYSTEM' has the required permissions.
VERBOSE: [<MY-SERVER>]: LCM:  [ End    Set      ]  [[SqlAG]Add<MY-AG>]  in 0.8620 seconds.
PowerShell DSC resource MSFT_SqlAG  failed to execute Set-TargetResource functionality with error message: Creating
the availability group '<MY-AG>'. InnerException: Cannot bind parameter 'InputObject'. Cannot convert the
"[<MY-SERVER>]" value of type "Microsoft.SqlServer.Management.Smo.Server" to type
"Microsoft.SqlServer.Management.Smo.Server".
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost
VERBOSE: [<MY-SERVER>]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : localhost
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 3.434 seconds

@johlju
Copy link
Member

johlju commented Jun 8, 2018

No worries. Looking at the output there are only one version of SQLPS, and the PowerShell module SqlServer is not present, but something is loading two version of the same assembly. So the wrong assembly is probably being used which gives this error.
Not sure where the v14 assembly is coming from as SQLPS module is the v12 version. 🤔

VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\14.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll
...
VERBOSE: [<MY-SERVER>]: [[SqlAG]Add<MY-AG>] GAC:True   Version:v2.0.50727   Location:C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll

The configuration you are running, is it configuring only one instance, or several instances of different SQL Server versions?
How does you configuration look like? (obfuscate any sensitive information)
Can you determine why there is v14 version of the assembly but there are no SQLPS or SqlServer module for v14?

@johlju johlju added the needs more information The issue needs more information from the author or the community. label Jun 8, 2018
@stale stale bot removed the needs more information The issue needs more information from the author or the community. label Jun 8, 2018
@johlju johlju added the needs more information The issue needs more information from the author or the community. label Jun 12, 2018
@ghost
Copy link

ghost commented Jun 13, 2018

Hey @johlju been following this feed for some time now, I am currently running into this same issue on the listener script for the InputObject, I had this same issue when creating the AG but my workaround was adding .name to serverobject variable for InputObject. I tried to use the same work around for the listener InputObject and it is giving me this error:

Cannot bind parameter 'InputObject'. Cannot convert the "wlewd000059ag1" value of type "System.String" to type "Microsoft.SqlServer.Management.Smo.AvailabilityGroup".
    + CategoryInfo          : InvalidArgument: (:) [], CimException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.SqlServer.Management.PowerShell.Hadr.NewSqlAvailabilityGroupListenerCommand
    + PSComputerName        : wlewd000059n1

We are using an older version of DSC 8.2, I know behind, but here is my output for Get-Module sql -ListAvailable

    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                                                           
---------- -------    ----                                ----------------                                                                                                           
Script     21.0.17262 SqlServer                           {Add-RoleMember, Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupListenerStaticIp, Add-SqlAzureAuthenticationContex...
Manifest   8.2.0.0    xSqlServer                                                                                                                                                     
Manifest   1.4.0.0    xSqlServer                                                                                                                                                     

    Directory: E:\Program Files (x86)\Microsoft SQL Server\140\Tools\PowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                                                                                           
---------- -------    ----                                ----------------                                                                                                           
Manifest   14.0       SQLPS                               {Backup-SqlDatabase, Save-SqlMigrationReport, Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupListenerStaticIp...}   

I have been following your recommendations and steps but looks like I am only running 1 assembly in the GAC_MSIL and that is version 14
Our Configuration is only configuring one instance at a time.

Any help on the matter would be appreciated!

Thanks

@johlju
Copy link
Member

johlju commented Jun 14, 2018

I guess since you are still on 8.2.0.0 this has worked previously? I see you are using the latest SqlServer module, will it work if you downgrade that?

The assemblies are packaged with SqlServer 🤔 So they should not load the SQLPS assemblies (v14).
We would want it to look something like this (see version and that GAC is false)

Import-Module -Name SqlServer
[System.AppDomain]::CurrentDomain.GetAssemblies() | ? Location -like *SqlServer* | % { Write-Verbose ("GAC:{0}`t`tVersion:{1}`t`tLocation:{2}" -f $_.GlobalAssemblyCache,$_.ImageRuntimeVersion,$_.Location) -Verbose }
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.PSSnapins.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Smo.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.AlwaysEncrypted.Types.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Dmf.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\DataSec.PAL.Interfaces.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.VulnerabilityAssessment.Model.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.PolyKit.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.PSProvider.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.PowerShell.Provider.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.AppLocal.Core.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.AppLocal.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.WmiEnum.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.PowerShell.Cmdlets.dll
VERBOSE: GAC:False  Version:v4.0.30319  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.AppLocal.Tabular.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Dmf.Common.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.RegisteredServers.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.RegSvrEnum.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.ServiceBrokerEnum.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.Collector.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.CollectorEnum.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.Utility.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.UtilityEnum.dll
VERBOSE: GAC:False  Version:v2.0.50727  Location:C:\Program
Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.HadrDMF.dll

@johlju
Copy link
Member

johlju commented Jun 14, 2018

Are any of you installing Analysis Services? The helper function Connect-SQLAnalysis is still wrongly using LoadWithPartialName() that will load the wrong assemblies.

https://github.com/PowerShell/SqlServerDsc/blob/4f9abeaf71b1d988df2be95c7bcd9bd27051720e/SqlServerDscHelper.psm1#L135

That row should be replaced with

https://github.com/PowerShell/SqlServerDsc/blob/4f9abeaf71b1d988df2be95c7bcd9bd27051720e/SqlServerDscHelper.psm1#L50

@ghost
Copy link

ghost commented Jun 14, 2018

So this did work with SqlPS but now we are trying to copy the module SQLServer from a golden server to the target nodes that DSC runs on, I will try to downgrade and see what I get and let you know.

I ran:
Import-Module -Name SqlServer
[System.AppDomain]::CurrentDomain.GetAssemblies() | ? Location -like SqlServer | % { Write-Verbose ("GAC:{0}ttVersion:{1}ttLocation:{2}" -f $.GlobalAssemblyCache,$.ImageRuntimeVersion,$_.Location) -Verbose }

and got back:
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.PSSnapins.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.ConnectionInfo.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.Sdk.Sfc.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Smo.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.SqlEnum.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.AlwaysEncrypted.Types.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.SmoExtended.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.SqlWmiManagement.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Dmf.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\DataSec.PAL.Interfaces.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.VulnerabilityAssessment.Model.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.PolyKit.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.PSProvider.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.PowerShell.Provider.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.AppLocal.Core.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.AppLocal.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.WmiEnum.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.SqlClrProvider.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.PowerShell.Cmdlets.dll
VERBOSE: GAC:False Version:v4.0.30319 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.AnalysisServices.AppLocal.Tabular.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Dmf.Common.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.RegisteredServers.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.RegSvrEnum.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.ServiceBrokerEnum.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.Collector.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.CollectorEnum.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.Utility.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.UtilityEnum.dll
VERBOSE: GAC:False Version:v2.0.50727 Location:C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.0.17262\Microsoft.SqlServer.Management.HadrDMF.dll

I updated the Connect-SQLAnalysis in my xSQLHelper.psm1 will post what happens next

@smastrorocco
Copy link

@johlju No, we are not installing AS. I believe the multiple versions are coming from the SQL install, and then SSMS v17.x. The resources work fine until SSMS is installed. Our setup is nothing special, it's more or less the default settings for the resources in this case. Single instance installed on single node. Resources are executed through chef-client using the dsc_resource resource.

@ghost
Copy link

ghost commented Jun 14, 2018

OK tried with versions 21.0.17099, 21.0.17152, 21.0.17199, 21.0.17262 and no luck, and looks like we are not install AS either

@ghost
Copy link

ghost commented Jun 14, 2018

also, when I dont use any versions of SQLServer it defaults to SQLPS and works just fine, problem is I need the SQLServer module on the target nodes

@johlju
Copy link
Member

johlju commented Jun 15, 2018

@travrat Could you provide your configuration with obfuscated sensitive information? Please make it as small as possible while still being able to reproduce the problem. I will try running it my lab an see if I get the same problem.

@johlju
Copy link
Member

johlju commented Jul 9, 2018

I have merged a few PR's that will mitigate the assembly problem in certain scenarios, for example when running more than one major version of SQL Server and using SQLPS. and refactored SqlServerNetwork resource to not import assemblies from GAC. See change log for a little more information.

There are a few more issues that need to be resolved (Connect-SQLAnalysis helper function, and SqlServerReplication resource) to only use the GAC that is in the session that is loaded by Import-SQLPSModule (we should really rename this, since it loads SqlServer module first if it exist). This would mitigate this issue further (if they are used in a configuration).

But there are scenarios, using some components together, that will never work due to hove the assemblies are loaded. If using SSMS 17.x, make sure to have SqlServer module on the target node (both SqlServer and SqlServerDsc should be on the target node). Using SQLPS module with SSMS 17.x will not work.

@stale
Copy link

stale bot commented Aug 8, 2018

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

@stale stale bot added the stale The issue or pull request was marked as stale because there hasn't been activity from the community. label Aug 8, 2018
@stale
Copy link

stale bot commented Sep 17, 2018

This issue has been automatically closed because it is has not had activity from the community in the last 40 days.

@stale stale bot closed this as completed Sep 17, 2018
@johlju johlju removed the needs more information The issue needs more information from the author or the community. label Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale The issue or pull request was marked as stale because there hasn't been activity from the community.
Projects
None yet
Development

No branches or pull requests

8 participants