PowerShell script exchange
Post Reply
veremin
Product Manager
Posts: 20408
Liked: 2299 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

No snap-ins have been registered for Windows PowerShell

Post by veremin » 4 people like this post

Challenge

While adding Veeam Backup and Replication snap-in, PowerShell returns the following error:

“No snap-ins have been registered for Windows PowerShell version”

Cause

The issue is typically caused by presence of two PowerShell instances (32-bit and 64-bit ones) inside 64-bit operating systems and is related to one of the following situations:
  • • Snap-in has been incorrectly registered (or has not been registered at all) for the improper PS instance either automatically or by user via instautil
    • User tries to add 64-bit snap-in from 32-bit PowerShell instance
    • 64-bit PowerShell shortcut is wrongly pointed to SysWOW64
    • Usage of Windows 2008 (R2) with default Powershell 2.0 (there are a lot of weird issues related to it)
    • etc.
Solution

Several possible approaches are suggested:
  • • Opening VB&R snap-in via icon in VB&R GUI, Menu -> PowerShell (as described here)
    • Manually registering snap-in
    • Checking corresponding registry hive and manually re-creating missing entities (as described here)
    • Updating default Powershell 2.0 in case of Windows Server 2008 (R2)
    • Reinstalling the latest Update, along with PS snap-in
    • Reinstalling everything from scratch (mostly applicable for those who are on free product version, as there is no historical data, configurable infrastructure, etc. ; might be a tough call for those who are on paid product versions)
More information

If neither of the suggested solutions does the trick for you or you have further questions, open a support case, as follows:
Thanks!
eeldivad
Influencer
Posts: 11
Liked: never
Joined: Apr 23, 2019 3:43 pm
Full Name: David Lee
Contact:

Re: No snap-ins have been registered for Windows PowerShell

Post by eeldivad »

I notice we don't need to register the snapin for newer versions of Powershell. I'm using Powershell 5. This might work for older versions too. I simply copy all files/subfolders of c:\Program Files\Veeam\Backup and Replication\Console
to another server anywhere you like. Then use import-module directly with Veeam.Backup.PowerShell.dll

import-module D:\scripts\Powershell\modules\Veeam\Veeam.Backup.PowerShell.dll

Now if you run get-module, you will see Veeam.Backup.Powershell listed

To get the list of commands available just run
get-command -module Veeam.Backup.Powershell

I haven't tested all the functions but they seem to work fine for me
oliverL
Enthusiast
Posts: 82
Liked: 11 times
Joined: Nov 11, 2016 8:56 am
Full Name: Oliver
Contact:

Re: No snap-ins have been registered for Windows PowerShell

Post by oliverL »

Merry Christmas! :-)

https://www.veeam.com/kb1489
I've been checking differet ISO Images but i can't find the Setup-File for the Powershell Module, atleast in the Backup Folder there is no BPS-File.

Where can i get a download link? Or is it possible to extract the Snapin from the Powershell Module?

I wanna create a Dokumentation Function so that i can create a report about the current Veeam Server with its Job etc. pp.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: No snap-ins have been registered for Windows PowerShell

Post by oleg.feoktistov »

Hi Oliver and Merry Christmas!

Starting from v9 Veeam PS Snap-in is integrated in VBR installation package.
So, with the current version, if you want to create your custom function out of Veeam powershell cmdlets, you would need a server with VBR instance running.
Anyway, internet abounds with various Veeam reports. I'm sure you can find the one fitting your goal. :wink:

Thanks,
Oleg
chris.arceneaux
VeeaMVP
Posts: 695
Liked: 374 times
Joined: Jun 24, 2019 1:39 pm
Full Name: Chris Arceneaux
Location: Georgia, USA
Contact:

Re: No snap-ins have been registered for Windows PowerShell

Post by chris.arceneaux »

Adding to what Oleg mentioned, you can also install the Veeam PS Snap-in on a different server by installing the Veeam Backup & Replication Console. The screenshot below was taken from our PowerShell documentation.

Image
veremin
Product Manager
Posts: 20408
Liked: 2299 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: No snap-ins have been registered for Windows PowerShell

Post by veremin »

Be aware that starting with Veeam Backup & Replication 11 there is no Veeam PowerShell Snap-in - it has been superseded by Veeam PowerShell Module.

Previous PowerShell scripts that attempt to load the snap-in will fail with the error "No snap-ins have been registered for Windows PowerShell".

To resolve the issue remove the following line from the existing scripts:

Code: Select all

Add-PSSnapin VeeamPSSnapin
Thanks!
alfonsrv
Novice
Posts: 3
Liked: never
Joined: Mar 26, 2023 9:58 am
Contact:

Re: No snap-ins have been registered for Windows PowerShell

Post by alfonsrv »

I found the best way to go about this issue is simply calling this function before doing anything related to Veeam.

Code: Select all

function Setup-VeeamPreflight {
    <#
    .SYNOPSIS Setup Veeam B&R connection reliably, www.rausys.de
    #>
    $InstallPath = Get-ItemProperty -Path "HKLM:\Software\Veeam\Veeam Backup and Replication\" | Select-Object -ExpandProperty CorePath;
    Add-Type -LiteralPath "$InstallPath\Veeam.Backup.Configuration.dll";
    if (-Not(Get-Command Connect-VBRServer)) {
        Add-PSSnapin VeeamPSSnapin;
    };
    try { Get-VBRServer | Out-Null; } catch { Connect-VBRServer; };
};
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests