PowerShell script exchange
Post Reply
MJlee
Service Provider
Posts: 10
Liked: never
Joined: Jun 24, 2021 4:55 am
Full Name: Maojun Li
Contact:

Veeam 11 powershell module doesn't work with Powershell 7

Post by MJlee »

I just found that Veeam 11 powershell module doesn't work with Powershell 7 for me. It works perfect with Powershell 5.

Has anyone seen the same issue as me by using powershell 7? Is there a fix?

Code: Select all

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)'.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Veeam 11 powershell module doesn't work with Powershell 7

Post by oleg.feoktistov »

Hi Maojun,

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.

Thanks,
Oleg
MJlee
Service Provider
Posts: 10
Liked: never
Joined: Jun 24, 2021 4:55 am
Full Name: Maojun Li
Contact:

Re: Veeam 11 powershell module doesn't work with Powershell 7

Post by MJlee »

Thanks Oleg, im looking forward your update.
Captnspdr
Veeam Vanguard
Posts: 27
Liked: 3 times
Joined: Apr 16, 2019 4:50 pm
Full Name: Jonah May
Contact:

Re: Veeam 11 powershell module doesn't work with Powershell 7

Post by Captnspdr »

Oleg,

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:

Get-VBRImportedEncryptedBackup
Get-VBRBackupRepository
Sync-VBRBackupRepository
Set-VBREncryptedBackupPassword
Get-VBRBackup

Just based on this I'd wager the issue is with most, if not all, of the methods in the module.
Captnspdr
Veeam Vanguard
Posts: 27
Liked: 3 times
Joined: Apr 16, 2019 4:50 pm
Full Name: Jonah May
Contact:

Re: Veeam 11 powershell module doesn't work with Powershell 7

Post by Captnspdr »

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:

Invoke-Command -ComputerName localhost -Scriptblock { Get-VBRBackup }
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Veeam 11 powershell module doesn't work with Powershell 7

Post by oleg.feoktistov » 1 person likes this post

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.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Veeam 11 powershell module doesn't work with Powershell 7

Post by oleg.feoktistov » 1 person likes this post

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.
albertwt
Veteran
Posts: 942
Liked: 53 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Veeam 11 powershell module doesn't work with Powershell 7

Post by albertwt »

Many thanks for sharing the compatibility @Oleg
--
/* Veeam software enthusiast user & supporter ! */
dk-one
Novice
Posts: 9
Liked: never
Joined: Feb 13, 2018 10:27 am
Contact:

Re: Veeam 11 powershell module doesn't work with Powershell 7

Post by dk-one »

You can add the following lines to get it working

Code: Select all

$VeeamModulePath = “C:\Program Files\Veeam\Backup and Replication\Console”
$env:PSModulePath = $env:PSModulePath + “$([System.IO.Path]::PathSeparator)$VeeamModulePath”
Import-Module -DisableNameChecking Veeam.Backup.PowerShell
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests