Solved

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

Posted on 2010-09-22
7
5,683 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

792 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