Geeks With Blogs

Lance's TextBox

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" />

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

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: