I am getting following error now:
PS C:\WINDOWS\system32> Test-DBADbCompatibility -SqlInstance localhost -Database EfficaDB
Cannot convert value "Version150" to type
"Microsoft.SqlServer.Management.Smo.CompatibilityLevel". Error: "Unable to match the
identifier name Version150 to a valid enumerator name.
Specify one of the following enumerator names and try again:Version60, Version65,
Version70, Version80, Version90, Version100, Version110, Version120, Version130, Version140"
At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.40\allcommands.ps1:77485 char:93
+ ... r.Management.Smo.CompatibilityLevel]"Version$($server.VersionMajor)0"+
~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : SubstringDisambiguationEnumParseThrewAnException
I have installed latest version of DBATools into the server.
I added the following statements at the start of the PowerShell script file, which solved the error:
import-module DBATools
import-module sqlserver