dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Get-DbaRepPublication -SqlInstance not working

Open mrwizard96 opened this issue 2 years ago • 5 comments

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

PS S:> Get-DbaRepPublication -SqlInstance sqlsw Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

Exception calling "LoadProperties" with "0" argument(s): "Method not found: 'Microsoft.Data.SqlClient.SqlDataReader Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(System.String)'." At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.145\allcommands.ps1:88350 char:9

  • if (!$repDB.LoadProperties()) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : MissingMethodException

PS S:>

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference

Get-DbaRepPublication -SqlInstance sqlsw

Please confirm that you are running the most recent version of dbatools

no I tried to updated to the latest version today. 1.1.145

I ran this today

Install-Module dbatools -force

but the version is still reporting as 1.1.145 instead of 2....

this is the output copied directly:

PS S:> Install-Module dbatools -force

PS S:> Get-Module dbatools | Select -ExpandProperty Version

Major Minor Build Revision


1 1 145 -1

Other details or mentions

you can see that I am attempting to run the latest version but the updater is not working. it is not reporting any errors when I run it.

What PowerShell host was used when producing this error

Windows PowerShell ISE (powershell_ise.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.20348.1850
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.1850
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2022 (RTM-GDR) (KB5021522) - 16.0.1050.5 (X64) Jan 23 2023 17:02:42 Copyright (C) 2022 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2022 Standard 10.0 <X64> (Build 20348: ) (Hypervisor)

But the replication is on a different version it is on:

Microsoft SQL Server 2016 (SP3-CU1-GDR) (KB5015371) - 13.0.7016.1 (X64) May 21 2022 01:00:03 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: ) (Hypervisor)

.NET Framework Version

.NET Framework 4.8.9167.0

mrwizard96 avatar Jul 18 '23 15:07 mrwizard96

To update the module please use Update-Module -Name dbatools.

andreasjordan avatar Jul 20 '23 08:07 andreasjordan

But there are no changes to that command for a long time...

Have a look at: https://github.com/dataplat/dbatools/issues/7428 - that might help you.

There is also an open pull request for a complete set of new commands: https://github.com/dataplat/dbatools/pull/8958

andreasjordan avatar Jul 20 '23 08:07 andreasjordan

To update the module please use Update-Module -Name dbatools.

that didn't work:

PS S:> Update-Module -Name dbatools

PS S:> Get-Module dbatools | Select -ExpandProperty Version

Major Minor Build Revision


1 1 145 -1

mrwizard96 avatar Jul 20 '23 14:07 mrwizard96

The update only updates. It does not import the module. Use Get-Module -ListAvailable -Name dbatools to check all installed versions.

andreasjordan avatar Jul 20 '23 14:07 andreasjordan

Hey @mrwizard96, Can you confirm if this is still a problem with a version of the module after 2.1.1 please?

jpomfret avatar Mar 15 '24 18:03 jpomfret

Will close this now, but can reopen if needed.

andreasjordan avatar Jun 05 '24 15:06 andreasjordan