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

  • Home
  • SEARCH
  • 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 9000271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:17:25+00:00 2026-06-16T00:17:25+00:00

I am attempting to programmatically launch the SharePoint Management Shell from C# code and

  • 0

I am attempting to programmatically launch the SharePoint Management Shell from C# code and I am getting different behavior that when I select it from the Start Menu. I have attempted to do this two different ways with the same result:

Attempt #1:

var startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
startInfo.FileName = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe";
startInfo.Arguments = "-NoExit \"  & 'C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\CONFIG\\POWERSHELL\\Registration\\sharepoint.ps1' \"";
Process.Start(startInfo);

Attempt #2:

var startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
startInfo.FileName = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Microsoft SharePoint 2010 Products\\SharePoint 2010 Management Shell.lnk";
Process.Start(startInfo);

Both of these methods launch a PowerShell window and display the following error message:

File C:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\14\CO NFIG\POWERSHELL\Registration\SharePoint.ps1 cannot be
loaded because the execut ion of scripts is disabled on this system.
Please see “get-help about_signing” for more details. At line:1 char:3
+ & <<<< ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensio ns\14\CONFIG\POWERSHELL\Registration\sharepoint.ps1 ‘
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException

When I launch it from the Start Menu, it works just fine. Any ideas on why this behaves differently? In Attempt #1 I am running the same executable and arguments as the Link. In Attempt #2 I am trying to run the link itself.

Thanks!

  • 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-06-16T00:17:26+00:00Added an answer on June 16, 2026 at 12:17 am

    This problem is usually caused by x86 and x64 PowerShell each requiring ExecutionPolicy to be set to something other than Restricted in order to run scripts. Perhaps your PowerShell console is x64 and your C# program is running as x86 or vice-versa. Either way, pass in an additional parameter to PowerShell -ExecutionPolicy ByPass to skip past this particular problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to programmatically add several Tiles which extend from TextViews into a RelativeLayout
I am attempting to write code to programmatically secure a service on a WSO2
I am attempting to programmatically retrieve the VM arguments from within a Java application.
I'm attempting to write some C# code to programmatically read/write the Family Safety controls
Attempting to use the data series from this example no longer passes the JSONLint
Attempting to make a NSObject called 'Person' that will hold the login details for
Attempting to change the files folder location in a Drupal site from /files to
I'm attempting to run a series of commands programmatically, read the error codes, and
I am attempting to run a JUnit Test from a Java Class with: JUnitCore
Currently we have a sequential workflow in sharepoint 2010 that has a delay activity.

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.