No snap ins have been registered for windows powershell version

I installed vSphere PowerCLI 5.5 on a Windows 7 32bit box and on a Windows 8.1 64bit box.

I try to run a .ps1 script that starts with lines like:

Add-PSSnapin VMware.VimAutomation.Core

Connect-VIServer …

get-vm …

On both PCs I get the same error:

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 4. (version 2 for the Windows 7 PC)

In <filename>.ps1:1 car:1

+ Add-PSSnapin VMware.VimAutomation.Core

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (VMware.VimAutomation.Core:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

While installing vSphere PowerCLI 5.5 I got no error.

On the Windows 7 PC there is WMware Player installed, in the Windows 8.1 PC there is VMware Workstation installed.

My scripts worked fine on a Windows XP box.

Is there anything I should do after installing vSphere PowerCLI 5.5?

Is there any releevant step I am missing?

Regards

marius

veremin

Product Manager
Posts: 20135
Liked: 2214 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

No snap-ins have been registered for Windows PowerShell

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:

  • • Go to the Customer Support Portal
    • Click the Get support tab
    • Open a case

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: 81
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: 1804
Liked: 608 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

veremin

Product Manager
Posts: 20135
Liked: 2214 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:

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; };
};

Who is online

Users browsing this forum: No registered users and 12 guests

I am trying to run a Powershell script on a web server where SQL Server Management Studio is not installed but all pertinent packages from the Microsoft SQL Server 2008 R2 SP2 Feature Pack have been installed. You need to install those small bits and pieces in order for Powershell to be able to run SQL commands.

Then I ran this setup script that preps your environment for SQL Server commands run with Powershell:

$ErrorActionPreference = "Stop"

$sqlpsreg="HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps"

if (Get-ChildItem $sqlpsreg -ErrorAction "SilentlyContinue")
{
    throw "SQL Server Powershell is not installed."
}
else
{
    $item = Get-ItemProperty $sqlpsreg
    $sqlpsPath = [System.IO.Path]::GetDirectoryName($item.Path)
}



/* Preload the assemblies. Note that most assemblies will be loaded when the provider
 is used. if you work only within the provider this may not be needed. It will reduce
 the shell's footprint if you leave these out.*/

$assemblylist =
"Microsoft.SqlServer.Smo",
"Microsoft.SqlServer.Dmf ",
"Microsoft.SqlServer.SqlWmiManagement ",
"Microsoft.SqlServer.ConnectionInfo ",
"Microsoft.SqlServer.SmoExtended ",
"Microsoft.SqlServer.Management.RegisteredServers ",
"Microsoft.SqlServer.Management.Sdk.Sfc ",
"Microsoft.SqlServer.SqlEnum ",
"Microsoft.SqlServer.RegSvrEnum ",
"Microsoft.SqlServer.WmiEnum ",
"Microsoft.SqlServer.ServiceBrokerEnum ",
"Microsoft.SqlServer.ConnectionInfoExtended ",
"Microsoft.SqlServer.Management.Collector ",
"Microsoft.SqlServer.Management.CollectorEnum"


foreach ($asm in $assemblylist)
{
    $asm = [Reflection.Assembly]::LoadWithPartialName($asm)
}


//Set variables that the provider expects (mandatory for the SQL provider)

Set-Variable -scope Global -name SqlServerMaximumChildItems -Value 0
Set-Variable -scope Global -name SqlServerConnectionTimeout -Value 30
Set-Variable -scope Global -name SqlServerIncludeSystemObjects -Value $false
Set-Variable -scope Global -name SqlServerMaximumTabCompletion -Value 1000


//Load the snapins, type data, format data

Push-Location
cd $sqlpsPath


Add-PSSnapin SqlServerCmdletSnapin100
Add-PSSnapin SqlServerProviderSnapin100 
Update-TypeData -PrependPath SQLProvider.Types.ps1xml  
update-FormatData -prependpath SQLProvider.Format.ps1xml  
Pop-Location

At Add-PSSnapin SqlServerCmdletSnapin100, the script fails with the following error:

No snap-ins have been registered for Windows PowerShell version 2. At
C:\Vantiv\Initialize-SqlpsEnvironment.ps1:75 char:13
+ Add-PSSnapin <<<< SqlServerCmdletSnapin100 #-ErrorAction SilentlyContinue
+ CategoryInfo : InvalidArgument: (SqlServerCmdletSnapin100:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

I ran a Google search on this error and the only solution I could find was that people were saying my 64-bit Powershell Console shortcut was pointed to the SysWOW64 directory rather than the System32. This is not the case for me. Mine points to System32.

Any ideas? What do I need to do to get Powershell to register those snap-ins?

  • Remove From My Forums
  • Question

  • Hi,

    I’m receiving the below error, when I try to add snap in for Sharepoint.

    Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2.
    At line:1 char:13
    + Add-PSSnapin <<<<  Microsoft.SharePoint.PowerShell
        + CategoryInfo          : InvalidArgument: (Microsoft.SharePoint.PowerShell:String) [Add-PSSnapin], PSArgumentException
        + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

    Your Response is highly appreciated.

    Gurusenthilkumar G

Answers

  • You need to run this on your Sharepoint machine.  Regular Powershell doesn’t come with any snap-ins.


    Grant Ward, a.k.a. Bigteddy

    • Proposed as answer by

      Wednesday, November 21, 2012 6:58 AM

    • Marked as answer by
      Yan Li_
      Monday, November 26, 2012 2:10 AM

    • Marked as answer by
      Yan Li_
      Monday, November 26, 2012 2:10 AM

check
Best Answer

  • Author Ivan Wang

    Did you run the command on your Exchange server(According to the cmdlet, your server seems to be Exchange 2016)? If you did that, try to reboot your Exchange server during non-working hours, maybe the rebooting will help you fix this issue.

    If you run it on the DC or other servers, you may get the «No snap-ins…» error. 


    Was this post helpful?
    thumb_up
    thumb_down

  • View Best Answer in replies below

    8 Replies

    • Author Ivan Wang

      Did you run the cmdlet in the proper PowerShell(Maybe it’s 64-bit)? What’s the version of your Exchange Server? Here is one document about the different versions of   importing the Exchange module(Exchange 2007/2010/2013/2016/2019):

      Import Exchange PowerShell Module Opens a new window.


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Michael Collis

      Hey I’ve already tried the 64bit version of power shell and get the same issue 😭


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Ivan Wang

      See if the cmdlet is available for the version of your Exchange Server via the above link. Maybe it’s helpful to you.


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Michael Collis

      Hey, Just tried running the following command on my exchange server 

      add-pssnapin microsoft.exchange.management.powershell.snapin

      And i get the error No snap-ins have been registered for Windows PowerShell version 4

      Thanks, 


      Was this post helpful?
      thumb_up
      thumb_down

    • Looks like the 32 bit version of PowerShell in the screenshot

      Try running PowerShell as Administrator and rerun that command

      Report back findings and a screenshot of any errors.


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Michael Collis

      Hey, thank you for your response

      I tried that and I got the same error message

      Thanks


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Ivan Wang

      Did you run the command on your Exchange server(According to the cmdlet, your server seems to be Exchange 2016)? If you did that, try to reboot your Exchange server during non-working hours, maybe the rebooting will help you fix this issue.

      If you run it on the DC or other servers, you may get the «No snap-ins…» error. 


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Ivan Wang

      Hi, it’s been a long time, is there any progress? If the issue has been fixed, you could share the solution or mark the best answer.


      Was this post helpful?
      thumb_up
      thumb_down

  • No bootable device на ноутбуке acer что делать windows 10
  • Node command not found windows
  • No bootable device insert boot disk and press any key при установке windows
  • Nod32 for windows 7 x32
  • No root cause windows 7 что делать