PowerShell script exchange
Post Reply
CrestoneGroup
Novice
Posts: 4
Liked: never
Joined: Oct 11, 2016 5:33 pm
Full Name: Dave Pavlicek
Contact:

Veeam snap-in loaded from an incorrect location

Post by CrestoneGroup »

Hello all,

I am trying to execute a Powershell backup script for the Free Veeam Backup and Replication product. It is the popular script published on the forum site. It had ran properly in the past. Now when I execute the script I get a the following: Get-VBRServer : Veeam PowerShell snap-in was loaded from an incorrect location. That is the first error, and it crashes on every line after that since that first line sets the Virtual Server object. The snap-in loads without any error. The powershell script is being run from a C:\Scripts folder. But it ran previously, and I haven't changed any powershell functions on that server. I did a google search and couldn't come up with anything specific to that text.

It is a Windows 2008 R2 server running PowerShell 4.0, running Veeam Free Version 9.0 Update 2.

Thanks for your attention.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam snap-in loaded from an incorrect location

Post by veremin »

Out of curiosity - are you trying to run script from a backup server itself or from a different machine backup console is installed on?
CrestoneGroup
Novice
Posts: 4
Liked: never
Joined: Oct 11, 2016 5:33 pm
Full Name: Dave Pavlicek
Contact:

Re: Veeam snap-in loaded from an incorrect location

Post by CrestoneGroup »

We have one server with Veeam installed. I am trying to run the script from that. The VSphere is on a different server.

My guess is that the snap-in registration somehow got corrupted, possibly during a Powershell upgrade or patch from Microsoft. Is there an easy way to unregister and re-register the snap-in ?

I am running the 64 bit powershell with this error. If I run the 32 bit, I get "No snap-ins have been registered for Powershell Version 4". I am assuming the snap-in was written for 64 bit platforms considering its registration and file location.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam snap-in loaded from an incorrect location

Post by veremin »

Is there an easy way to unregister and re-register the snap-in ?
Try this:

- Remove everything that is present in the following registry hive:

Code: Select all

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\VeeamPSSnapIn
- Re-install snap-in either by clicking Menu -> PowerShell (backup console) or executing Install-VeeamToolkit.ps1 script that is located inside product directory

Thanks.
CrestoneGroup
Novice
Posts: 4
Liked: never
Joined: Oct 11, 2016 5:33 pm
Full Name: Dave Pavlicek
Contact:

Re: Veeam snap-in loaded from an incorrect location

Post by CrestoneGroup »

Hmm.. Installation of the snapin succeeded with no errors. But same error on the backup script.

Paths in the registry config look correct.

Any other suggestions ?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam snap-in loaded from an incorrect location

Post by veremin »

You can try to remove the said hive once again, then, execute VB&R setup, (re-)install only UI portion (backup console), then, open UI -> Menu -> PowerShell, and see whether this operation helps or not. Thanks.
CrestoneGroup
Novice
Posts: 4
Liked: never
Joined: Oct 11, 2016 5:33 pm
Full Name: Dave Pavlicek
Contact:

Re: Veeam snap-in loaded from an incorrect location

Post by CrestoneGroup »

That did the trick.

I appreciate your help and love your script.

Thank you again
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam snap-in loaded from an incorrect location

Post by veremin »

You're welcome. It appears that snap-in registration got corrupted somehow, but by sticking to the right re-registration procedure you were able to resolve that. But it's worth double checking with support team prior to running the utility.

Thanks.
sysnet
Lurker
Posts: 2
Liked: 1 time
Joined: Nov 07, 2017 9:44 am
Full Name: sysnet
Contact:

Re: Veeam snap-in loaded from an incorrect location

Post by sysnet »

v.Eremin wrote:Is there an easy way to unregister and re-register the snap-in ?
Try this:

- Remove everything that is present in the following registry hive:

Code: Select all

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\VeeamPSSnapIn
- Re-install snap-in either by clicking Menu -> PowerShell (backup console) or executing Install-VeeamToolkit.ps1 script that is located inside product directory

Thanks.
After installing Veeam 9.5 U3a update, we had the same problem. The location registered in the key was :

"ApplicationBase"="C:\\Program Files\\Veeam\\Backup and Replication\\Backup"
"ModuleName"="C:\\Program Files\\Veeam\\Backup and Replication\\Backup\\Veeam.Backup.PowerShell.dll"

After removing VeeamPSSnapIn registry key content and re-registered the snap-in, the location has changed :

"ApplicationBase"="C:\\Program Files\\Veeam\\Backup and Replication\\Console"
"ModuleName"="C:\\Program Files\\Veeam\\Backup and Replication\\Console\\Veeam.Backup.PowerShell.dll"

Thank you v.Eremin!
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests