Solved

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

Posted on 2010-09-22
7
5,616 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

Is Your AD Toolbox Looking More Like a Toybox?

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.

Question has a verified solution.

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

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
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 …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

773 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