View Single Post
Old 09-22-2008   #5 (permalink)
Karl Mitschke


 
 

RE: Execute a powershell script from a webpage

Hello kjhoff123,
Quote:

> I configured PowerShellASP, does anyone have any idea on how to add
> the Exchange Snap in to this tool? I haven't found anything online and
> am not a programmer. But this would be a great tool especially for
> those non IE users that need to see their exchange quota?
>
> "BZP" wrote:
>
Quote:

>> Hello,
>>
>> I wonder if it is possible to execute a powershell script and show
>> the result in a the page from a IIS website (6.0 on a W2003 R2 Ent
>> SP2).
>>
>> Thanks for your help.
>>
>> --
>> P.J.A.
I am just starting to rewrite my ASP poages that use C# and powershell to
use powershellASP.

To add the Exchange snappin, do this:

<% add-pssnapin *exchange* %>

The web page will have to run in an application pool that is configured wtih
an account that hads the proper exchange permissions to gather the data that
you weant to return to the user.

Then, try this:

<head>
<style>
body,td,th { font-family: Arial, Helvetica, sans-serif; font-size:
14px; }
h1 { font-size: 26px; color: #0B4982; }
#left { float:left; margin:10px; width:180px; border:1px
solid gainsboro;font-weight:bold}
#left P { border-bottom:1px solid gainsboro;padding:4px;
margin-bottom:2px;margin-top:2px; }
#left UL { margin:2px; padding:0px; }
#left LI { list-style: none; margin:4px; }
</style>
</head>
<body>
<% add-pssnapin *exchange* %>
<% $mailboxname = $request['logon_user'].split("\")[1]%>
<% get-mailboxfolderstatistics $mailboxname | ft FolderPath, ItemsInFolder,
@{Label="FolderSize(MB)";expression={$_.FolderSize.ToMB()} } -auto %>
</body>


You will have toi fornat the results to your liking


My System SpecsSystem Spec