locked
Run SharePoint Management Shell (2010) through VB GUI? RRS feed

  • Question

  • (I tried posting this in the VB IDE forum and they said to try here, since it would need to be run on a SharePoint site.)

    Is there a way to access and run SharePoint Powershell through a VB.Net Windows Form, much as you can use Process.start for other things (cmd prompt, etc)?

    Let's say, for example, I wanted to run the install-spSolution cmdlet, and I wanted to have a couple of textboxes for the identity and webapplication and then a checkbox for GacDeployment. then, I want to put that all together & run the cmdlet with the info in my form by clicking a button.

    Is there a site/page that shows the code on how to get this done?

    Thursday, October 20, 2011 7:02 PM

Answers

All replies

  • Is there a way to access and run SharePoint Powershell through a VB.Net Windows Form, much as you can use Process.start for other things (cmd prompt, etc)?

    Is there a site/page that shows the code on how to get this done?

    • Merged by Liliane Teng Friday, October 21, 2011 6:09 AM same question
    Wednesday, October 12, 2011 4:31 PM
  • Hi AugustWind,

    Thanks for your post.

    Based on my understanding, do you mean how to run PowerShell Script in VB.NET? If so, please check below articles about how to run PowerShell from .net code. Hope they could make you get some ideas.

    http://blogs.msdn.com/zainnab/archive/2008/07/26/calling-a-powershell-script-from-your-net-code.aspx
    (Calling a PowerShell Script From Your .NET Code)

    http://blogs.msdn.com/b/daiken/archive/2007/02/07/creating-a-windows-powershell-cmdlet-using-the-visual-studio-windows-powershell-templates.aspx (Creating a Windows PowerShell CmdLet using the Visual Studio Windows PowerShell Templates)

    http://www.codeproject.com/KB/cs/HowToRunPowerShell.aspx (How to run PowerShell scripts from C#)

    For c# code, you could convert to VB.NET by http://www.carlosag.net/Tools/CodeTranslator/

    If you have any concerns, please feel free to follow up.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by AugustWind Monday, January 23, 2012 5:43 PM
    Thursday, October 13, 2011 5:59 AM
  • you're right on top of what I need - - but I need know how to run SharePoint Management Shell (which is similar, but has all the bells and whistles to run SharePoint scripts)

    Obviously, I know it will need to be running on a SharePoint server -

    for instance - to install/add a solution in Sharepoint, you need to specify the name of the solution, and the url where it's going and whether or not there's a GAC installation - that kind of thing - so I want to be able to just fill in a few textboxes, select a checkbox and click a button, and then have a window for messages that you get back.

     

    Thursday, October 13, 2011 2:29 PM
  • Hi AugustWind,

    Based on your followed question, as you said, it will need to be running on a SharePoint Server. I recommend you could consider to create a new thread in the SharePoint forum because more this aspects experts live there. This one seems more appropriate:

    http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010programming/threads?page=3 (SharePoint 2010 - Using Visual Studio with SharePoint and other programming)

    Thanks for your understanding.

    Have a nice day.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, October 14, 2011 7:15 AM
  • Hi AugustWind,

    Would you mind letting us know the situation on your side now? Do you have any updates?

    Have a nice day.

    Best rgards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, October 20, 2011 7:28 AM
  • Now that this is in a new section - does anyone have any input on this?
    Tuesday, November 1, 2011 1:40 PM
  • You know how to run powershell scripts from code.  I don't see what else you need.  You don't need to be using a different IDE because you're not using any IDE to run the scripts, you're just running it from code.

    If you don't know the powershell commands to do what you want, then that's a different issue entirely, and you should probably create a new thread (here) for assistance with that.

    Tuesday, November 1, 2011 3:39 PM
  • when you mean 'from code', do you mean using the PowerShell command shell? Yes, I know how to create and use cmdlets - - BUT

    I want to create a customized Windows Forms GUI to do only a hand full of certain commands, so I don't have to go back to a reference to remember the exact syntax every time.

    and I've already had this in another location - This is a new thread.

    This is where the the MS people told me to put the new thread - but they added their comments from the other thread

    • Edited by AugustWind Tuesday, November 1, 2011 3:46 PM
    Tuesday, November 1, 2011 3:42 PM
  • Yes, I realize all of that.  A previous post in this thread shows you how to run powershell commands from .NET code, which is exactly what you need to do.  So unless you don't know what powershell commands you need to use to do what you want, I fail to see what is left unanswered about your question.

    When I say "from code" I don't mean in the powershell command shell, no, I mean in C#/VB.NET code, as seen in the links provided above.  That's what you need to do, and it shows you exactly how to do it.  Just read through the links provided since I get the impression you haven't even done that yet.

    Tuesday, November 1, 2011 4:07 PM