Geeks With Blogs

News

qrcode

Lance Robinson

Create Your Badge

Lance Robinson is a software engineer in Durham, Chapel Hill, Raleigh, and surrounding areas. More about Lance.

 Subscribe


Lance's TextBox » About Me » My Resume »Twitter

Using the PowerShellToys PowerShellWebPart, I was able to insert a PowerShell command prompt inside my SharePoint page with only a few lines of code and some html.  Here is the PowerShellWebPart template that I used:

<div style="background-color:DarkBlue; color:white; height:400px; width:650px">
<form method="GET" action="" enctype="multipart/form-data">
  PS>  <input type=text name="query" size="40" value="<%=$request['query']%>"  />
  <input type=submit value="Execute" />
</form>

<% 
if ($request['query'] -ne "" -and $request['query'] -ne $null) {
%>
  <pre>
  <% invoke-expression $request['query'] %>
  </pre>
<%
}
%>
</div>

To use this yourself, just install the PowerShellToys PowerShell Web Part, modify the web part, open its source editor and paste the above example in.  Then just click "Apply" and voila!

Other PowerShellWebPart demos.

Posted on Tuesday, May 5, 2009 3:47 PM PowerShell | Back to top


Comments on this post: PowerShell Prompt inside SharePoint

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Lance Robinson | Powered by: GeeksWithBlogs.net