Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1023619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:39:09+00:00 2026-05-16T11:39:09+00:00

I am struggling getting Exchange mManagement Shell commands to run in my C# code.

  • 0

I am struggling getting Exchange mManagement Shell commands to run in my C# code. Here’ the problem.

I have access to a test Exchange Server running Exchange 2010.

I have run my Exchange Mgmt Shell commands directly on the server inside the Exchange Mgmt Shell
Simple Example: get-mailbox

I created a console app to run my PS commands

I placed the exe file on the Exchange Server and tried to run it

I get an error on the PSSnapInInfo info = rsConfig.AddPSSnapIn line of code:

                //Creating and Opening a Runspace
            RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
            PSSnapInException snapInException = null;
            PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out snapInException);
            Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsConfig);
            myRunSpace.Open();

There is another post with this exact same issue but no real answer so I am starting this one.

The problem is simple. I can’t add the snapin called “Microsoft.Exchange.Management.PowerShell.Admin”. All the documentation I read on the net says this is the command that will work. In fact I found this post, http://msdn.microsoft.com/en-us/library/bb332449(EXCHG.80).aspx that is very straight forward and seems very simple. Did “Microsoft.Exchange.Management.PowerShell.Admin” go away in Exchange 2010? Is there another snapin I should be referencing? This should ber really simple but I can’t get past this error.

BTW, the error I get is: “No snap-ins have been registered for Windows PowerShell version 2.”

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:39:10+00:00Added an answer on May 16, 2026 at 11:39 am

    Assuming the server is 64-bit, it might be related to how the snap-in was registered. For example, if you’re running the x86 version of PowerShell it runs in WOW. Therefore, when you run InstallUtil to register the snap-in it gets registered specifically for x86, which in turn is not available to x64. Assuming this, if your C# application was compiled specifically for the x86 platform I would bet that it would work. This is one solution, but not always acceptable.

    Ensure that you’re running the correct version of PowerShell (x86/x64) and rerun the snap-in registration with the correct version of InstallUtil. For x64, you’ll need to run the InstallUtil that lives under the .NET Framework64 directory.

    One way to check you’re in the correct version of PowerShell is to examine the environment variable, env:PROCESSOR_ARCHITECTURE in your shell.

    x64:

    > get-item env:PROCESSOR_ARCHITECTURE
    Name                           Value
    ----                           -----
    PROCESSOR_ARCHITECTURE         AMD64
    

    x86:

    > get-item env:PROCESSOR_ARCHITECTURE
    Name                           Value
    ----                           -----
    PROCESSOR_ARCHITECTURE         x86
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling getting some unit tests running and wondering if anyone might have anything
I have been struggling in getting Start Tls to work for my ldap server.
I'm struggling through getting everything set up here, I have my extension installed in
I have been struggling with getting an opposite search in MySQL. Here is a
I'm struggling with getting IOC to work in a remoting scenario. I have my
I'm using Windows 7 (IIS 7.5) and have been struggling with getting it setup
Im struggling to find any information on getting meta values. I have a locale
I have been struggling with getting a field value change to commit. Is there
I'm struggling with getting Linq To NHibernate to work. I have referenced NHibernate, NHibernate.Linq
I have been struggling with getting this to work for a number of days

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.