-
Notifications
You must be signed in to change notification settings - Fork 225
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
SqlProtocol: Throws exception when used with SQL Server 2022 #1802
Comments
This seems to be a problem with the PowerShell module SqlServer. It works with the PowerShell module SQLPS that comes with the installation of SQL Server 2022, but it does not work with SqlServer from PowerShell Gallery. SQLPS: PS > import-module sqlps
PS > $a = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer -ArgumentList localhost
PS > $a
ConnectionSettings : Microsoft.SqlServer.Management.Smo.Wmi.WmiConnectionInfo
Services : {MSSQL$SQL2022, SQLAgent$SQL2022, SQLBrowser}
ClientProtocols : {}
ServerInstances : {SQL2022}
ServerAliases : {}
Urn : ManagedComputer[@Name='localhost']
Name : localhost
Properties : {}
UserData :
State : Existing SqlServer: PS > import-module sqlserver
PS > $a = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer -ArgumentList localhost
PS > $a
ConnectionSettings : Microsoft.SqlServer.Management.Smo.Wmi.WmiConnectionInfo
Services :
ClientProtocols :
ServerInstances :
ServerAliases :
Urn : ManagedComputer[@Name='localhost']
Name : localhost
Properties : {}
UserData :
State : Existing |
It seems also work with the PowerShell module dbatools. PS > import-module dbatools
PS > $a = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer -ArgumentList localhost
PS > $a
ConnectionSettings : Microsoft.SqlServer.Management.Smo.Wmi.WmiConnectionInfo
Services : {MSSQL$SQL2022, SQLAgent$SQL2022, SQLBrowser}
ClientProtocols : {}
ServerInstances : {SQL2022}
ServerAliases : {}
Urn : ManagedComputer[@Name='localhost']
Name : localhost
Properties : {}
UserData :
State : Existing |
@johlju were you able to solve this issue? I'm facing the same with SQL2022 and DSC module. |
The root cause is that SQL Server team has not updated their module SqlServer with the latest SMO assemblies. I have tried to leverage module dbatools, but couldn't get the integration tests to pass. I thought about looking into leverage dbatools.library but haven't had time, and won't have time, to work on it. Please see if you can leverage dbatools to get this working. I started PR #1808 that suggest a change but that fails tests, so something is different. Just kicked of the build again to see what breaks. |
This was resolved with PR #1808. To use this resource on SQL Server 2022 the SqlServer module 22.0.49-preview is needed, and also the latest preview of SqlServerDsc (building and deploying as I write this). |
Problem description
When running the integration tests for SqlProtocol, on the build worker that have installed the SQL Server 2022 of the Database Engine, it fails with an exception. It seems it fails when getting the current state.
To reproduce, enable the Pester tag
'Integration_SQL2022'
on line 39 in the integration tests of SqlProtocol and then run the pipeline (or the integration test).This has probably something to do with the type
Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer
. Maybe we need to install a newer version of the SqlServer PowerShell module. But it is all a guess since I have not debugged the resource. 🤔Verbose logs
DSC configuration
Suggested solution
Unknown. But seems this need to be handled differently for SQL Server 2022.
SQL Server edition and version
SQL Server PowerShell modules
Operating system
PowerShell version
SqlServerDsc version
The text was updated successfully, but these errors were encountered: