Here is the code snippet that would invoke SharePoint 2010 Powershell cmdlets from VS 2010
You have to reference System.Management.Automation and include the following statements
There are various ways to invoke SP 2010 cmdlets, but the code snippet shows using RunspaceConfiguration to achieve this. On pasting the method into a standard windows form with a command button and text box, this is what the output would look like
The code snippet calls the “Get-SPSite” cmdlet from SharePoint Windows PowerShell.
- Make sure you are targeting Framework 3.5 in VS 2010
- Platform target is set to x64
I have used a simple text box to show results. There are many possibilities like feeding results to SilverLight (or) Visio Services…
Hope you find this useful!