Geeks With Blogs



Lance Robinson

Create Your Badge

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


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

PowerShellASP is a powerful tool for generating web pages with PowerShell.  It allows you to insert PowerShell script directly into a webpage (a .ps1x page), that code will be executed and the resulting powershell objects are renderable in your page.  It also exposes familiar $response, $request, $server, etc. for accessing response, request, and other information about the HTTP context.

This example shows how to use PowerShellASP to generate an RSS podcast feed.  The dir command in PowerShell (get-childitem) is used to get a listing of files to use as enclosures in the feed.

This example demonstrates how to generate an RSS feed from PowerShell cmdlet output objects.

$Response.contenttype = "text/xml";

<!-- output the rss channel -->
<rss version="2.0">
    <title>PowerShellASP Get-RSS Sample</title>
    <description>This example uses PowerShellASP to generate an RSS feed using PowerShell cmdlets.</description>
    <pubDate>Tue, 21 Apr 2009 14:04:57 GMT</pubDate>
$mediapath = "C:\Testing\media";
dir $mediapath | % {
  $url = "http://" + $request.servervariables["SERVER_NAME"] + ":" + $request.servervariables["SERVER_PORT"] + "/virtualdirectory/" + $_.Name;               
<title>Podcast episode: <%=$_.Name%></title>
<enclosure url="<%=$url%>" length="<%=$_.Length%>" type="audio/mp3" />

<!-- close the rss channel -->


Posted on Tuesday, April 21, 2009 3:08 PM PowerShell | Back to top

Comments on this post: PowerShellASP – Generate an RSS feed from PowerShell cmdlets

# PowerShellASP – Generate an RSS feed from PowerShell cmdlets
Requesting Gravatar...
hello :)

i dont have any result :(

$rssUrl = ""
$WebClient = New-Object System.Net.WebClient
$WebClient.Encoding = [System.Text.Encoding]::UTF8
$agenda = [xml]$WebClient.DownloadString($rssUrl)

$item1 = $agenda.SelectNode.title.item.title[1]."#text"
$pubDate1 = $agenda.SelectNode.item.pubDate[1]."#text"

$item2 = $agenda.SelectNode.item.title[2]."#text"
$pubDate2 = $agenda.SelectNode.item.pubDate[2]."#text"
i have 8 ligne

pls help me
Left by arnold on May 25, 2009 3:06 PM

Your comment:
 (will show your gravatar)

Copyright © Lance Robinson | Powered by: