PowerShell Prompt inside SharePoint

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.

Print | posted on Tuesday, May 05, 2009 3:47 PM

Feedback

No comments posted yet.

Your comment:





 
 

Copyright © Lance Robinson

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski