Solved

No snap-ins have been registered for Windows PowerShell version 2

Posted on 2010-09-22
7
5,480 Views
Last Modified: 2012-05-10
Hi.. I'm calling C# code.. I'm getting the following error

"No snap-ins have been registered for Windows PowerShell version 2"

at

 config.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out warning);

What I'm I missing. I have the Exchange Management Tools installed....
thanks
0
Comment
Question by:JElster
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33748409
0
 
LVL 1

Author Comment

by:JElster
ID: 33748509
I'm on 64 get the same message.............  Tired on 32 too......
Tried compliing my page as 64,  I go into PS and see the snap in has been added.
?????????????????????
0
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33748750
According to this, maybe you need to install exchange Management Tools on the Visual Studio Remote machine...

http://blogs.msdn.com/b/akashb/archive/2009/01/30/howto-using-powershell-in-asp-net-net-framework-2-0.aspx
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:JElster
ID: 33748763
I did that too.........  The machine shows that they are loaded...........
?????????????????????
0
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33749090
Can you post the code....maybe set breakpoints to check values....

http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/41c9cd78-74ad-4903-8a77-be6c09724669

It's suggested to compile unmanaged as managed here:
http://stackoverflow.com/questions/492953/calling-powershell-scripts-from-unmanaged-c

"The MS suggestion would probably be to compile specific classes/modules in your generally unmanaged C++ app as managed code (compiling individual files with /clr), and letting the IJW transition code manage the calls to/from it (and calling PowerShell API's from the managed bits). I've been told (from MS VC++ people) that's the expected methodology for adding bits of managed calls to large unmanaged applications."


0
 
LVL 1

Accepted Solution

by:
JElster earned 0 total points
ID: 33749199
Your first link is exaclty my issue.. but what's the solution?
0
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33754337
http://blogs.msdn.com/b/pareshj/archive/2010/07/30/error-msg-no-snap-ins-have-been-registered-for-windows-powershell-version-2.aspx
From link:
- wrong version of installutil.exe and the snapin got registered under WOW hives of a 64bit machine
- Also review the shortcut to powershell, are you loading up the 32 bit version of 64 bit?

Maybe?
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now