Veeam v11 changed from a powershell snap-in to a powershell module. As such it broke everything.

In v10 and earlier Veeam PS you probably loaded it something like this:

$snaps = Get-PSSnapin
foreach($snap in $snaps){if($ -eq "VeeamPSSnapin"){$exflag = 1}}
if($exflag -ne 1){
      Add-PSSnapin -name VeeamPSSnapin -erroraction silentlycontinue
      if($error -ne $null){write-host "CRITICAL - Could not load Veeam snapin";exit 2}
} of your existing code

Well, Veeam decided "due to popular demand" to change this and broke everything. After struggling for a few days to figure out the secret sauce (I had a lot of trouble invoking the new module non-interactively) I hit pay dirt.

For Veeam v11 simply change the above code to this:

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

Connect-VBRServer of your existing code

Now, I don't have any error checking code in there yet, but this may help some people when the upgrade.

FYI the secret sauce for non-interactive was adding the explicit  Veeam Path (the top two lines of the new code). If your module install path is different adjust accordingly. You can probably achieve the same "fix" by manually adding the Veeam Console path to the local environment variable "PSModulePath" on the Veeam server, I haven't tried that yet and the code way of adding the path is more flexible when I'm copying code around to different systems:

Image:Upgraded to Veeam v11 and now all your Veeam related powershell scripts are broke?
Darren Duke   |   April 23 2021 03:57:25 AM   |    veeam  security    |  
  |   Next Document   |   Previous Document

Discussion for this entry is now closed.

Comments (0)

No Comments Found