2011-03-30

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

I was getting this message in SPPower (http://sppower.codeplex.com/), an application I am building to run powershell commands from WPF.

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

The code was basically this:

using (PowerShell ps = PowerShell.Create()) {
PSSnapInException ex = null
ps.Runspace.RunspaceConfiguration.AddPSSnapIn("Microsoft.SharePoint.PowerShell", out ex);

Doing a search returned this helpful link:

http://blogs.msdn.com/b/pareshj/archive/2010/07/30/error-msg-no-snap-ins-have-been-registered-for-windows-powershell-version-2.aspx

This suggested it was something to do with the different OS architectures.

Then it hit me, i was developing on Vista x86, but needed it to run on Windows 2008 x64. So I went to the visual studio project, and found it was targeted to x86 platform. All i needed to do was change it to "Any CPU", so it works on both the development and target environments

7 comments:

Anonymous said...

Hi,
I am trying to use the exchange 2010 cmdlet from ASP.NET C#. When I am trying to add the snap in "add-pssnapin Microsoft.Exchange.Management.Powershell.E2010"
I am getting error as "No snap-ins have been registered for Windows PowerShell version 2" I changed the ASP.NET configuration setting to x64 bit even though I am getting the error. Please sort it out.

Anonymous said...

please mail me at smooth.munna@gmail.com

Rahul said...

Thank you very much. you saved my day..!!!..

Anonymous said...

Hello there! This post could not be written any better!
Reading this post reminds me of my good old room mate!
He always kept chatting about this. I will forward this write-up to him.
Fairly certain he will have a good read. Many thanks for sharing!


my page diets that work for women
Also see my page :: diet that works

Anonymous said...

I am sure you will love smvknYPY [URL=http://www.cheapdesigner--handbags.weebly.com/]replica designer purses[/URL] and get big save KCAjoPyA [URL=http://www.cheapdesigner--handbags.weebly.com/ ] http://www.cheapdesigner--handbags.weebly.com/ [/URL]

Anonymous said...

check out this site why not try this out article source browse this site click resources visit site

anosh said...

أسعار الكشف عن تسربات المياه
"
عزل أسطح بالرياض
"
"
افضل شركة عزل خزانات بالرياض
"
"
شركة عوازل خزانات بالرياض
"
اسعار عزل الأسطح بالرياض
أسعار كشف تسربات المياه بالرياض
عزل الأسطح بواسطة العازل السائل هو أحد أساليب العزل الشائعة والفعالة في الرياض. يتم استخدام المواد السائلة مثل البتومين أو الراتنجات الاصطناعية لتكوين طبقة واقية على سطح الأسطح. وتتميز هذه الطريقة بقدرتها على ملء جميع الفجوات والشقوق في الأسطح، مما يمنع تسرب المياه والحرارة. كما أنها تقاوم التغيرات المناخية والتآكل.