PS C:\Windows\System32> Import-Module Veeam.Backup.PowerShell
WARNING: The names of some imported commands from the module 'Veeam.Backup.PowerShell' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
PS C:\Windows\System32> Connect-VBRServer
Connect-VBRServer: Argument 'Connect-VBRServer' is not recognized as a cmdlet: Method not found: 'Void System.Threading.Mutex..ctor(Boolean, System.String, Boolean ByRef, System.Security.AccessControl.MutexSecurity)'.
PS C:\Windows\System32> $VeeamModulePath = "C:\Program Files\Veeam\Backup and Replication\Console"
PS C:\Windows\System32> $env:PSModulePath = $env:PSModulePath + "$([System.IO.Path]::PathSeparator)$VeeamModulePath"
PS C:\Windows\System32> Import-Module -DisableNameChecking Veeam.Backup.PowerShell
PS C:\Windows\System32> Connect-VBRServer
Connect-VBRServer: Argument 'Connect-VBRServer' is not recognized as a cmdlet: Method not found: 'Void System.Threading.Mutex..ctor(Boolean, System.String, Boolean ByRef, System.Security.AccessControl.MutexSecurity)'.
Yes, I'm experiencing the same issue. In fact, I tested it with several Powershell Core builds, including the latest preview of v7. The issue is always the same. Before diving any deeper, from what I see in the error, I assume that the method referenced in our code doesn't exist in .NET Core implementation, which Powershell 6.x+ strictly relies on. I raised this question internally and will update this thread as soon as we have any clear answers to this behaviour.
I am seeing the same things you are when trying to test the new module with PS 7, including 7.2 Preview 8. The error seems to be for calls other than just Connect-VBRServer. Here are some of the calls I have tested that are giving the same error:
For now it looks like you can call the non-core PowerShell installation on the server from PowerShell Core to get the module working. For example, on my dev server I have Server 2019 w/ PowerShell 5.1 and 7.2 Preview 8 installed. Inside 7.2, I called the below command, which returned back nearly identical results to a call in 5.1:
Checked it with QA and Dev. I'm afraid, my suspicion was correct. We, indeed, have numerous references to Mutex class in our code. So, unless we adapt it to .NET Core, it will work only in environments with .NET Framework. Since Powershell is built on top of a .NET, the adaptation would mean transforming everything we have in .NET Framework to everything that is supported in .NET Core plus writing custom parts, which are not implemented there (like Mutex multithreading). Hence, to my deepest regret, I must note that Powershell v6.x+ is currently not supported.
For now it looks like you can call the non-core PowerShell installation on the server from PowerShell Core to get the module working.
Correct, but it would still require calling .NET Framework libraries, which works in your case of v5.1 and v7.2 co-living. As soon as v5.1 is uninstalled or v7.2 is forced as a default powershell environment, calls will fail.