I'm running the below Powershell
Export-DbaInstance -SqlInstance xxxxxx\xxxxxx -ExcludePassword -Exclude databases -Path \\xxxxx\xxxxx
However, I'm getting the error
'WARNING: [14:34:02][Export-DbaRepServerSetting] Could not load replication libraries | Could not load file or 'Microsoft.SqlServer.Replication.dll' or one of its dependencies. The specified module could not be found.'
It successfully exports everything else except instance replication. I can use the -Exclude 'ReplicationSettings'
and Export-DBAInstance
works successfully. I can also successfully execute the original script on a Windows 2016 server with any other version of SQL installed.
The Server is Windows 2016 and SQL is 2019 Standard. The file version of the Microsoft.SqlServer.Replication.dll
in dbatools smo folder is 2017.140.1000.169 and product version is 14.0.1000.169. The versions in C:\Program Files\Microsoft SQL Server\150\SDK\Assemblies
are 2019.150.2000.5 and 15.0.2000.5 respectively.
I have also tried executing Invoke-Expression (Invoke-WebRequest -UseBasicParsing https://dbatools.io/in)
to download latest version of dbatools, unblocking the file and importing the dbatools module. I've also tried copying the Microsoft.SqlServer.Replication.dll
from a SQL 2016\2012 and 2017 instance into the Assemblies folder above.