Search TechNet Script Center Forum for Unanswered PowerShell Questions

March 5, 2011 at 1:03 AMAndy Schneider

I wanted a quick and easy way to search the TechNet Script Center forums for all questions that had the word “PowerShell” in either the title or in the question itself. Here is what I came up with:

001
002
003
004
005
006
007
008
009
010
011
Function Get-ScriptCenterUnanswered {
$url = 
"http://social.technet.microsoft.com/Forums/en/ITCG/threads?outputAs=rss&filter=unanswered"
$web
 = New-Object System.Net.WebClient
$rss = $web.downloadString($url)
$cleaned = $rss -replace  '',
""
$xml
 = [xml]
$cleaned
$xml
.rss.channel.item | ? {
        ($_.Title -like "*powershell*") -or ($_.Description -like "*powershell*")
 
       
} | fl title,link
}

You can use a filter to get only the unanswered questions. Once I pulled those down, I found that it was giving me some odd characters at the beginning of the feed. I just used the –replace operator to get rid of them. Once I did that, I can convert to XML and treat the output as an object and use the where-object cmdlet to filter the output based on my criteria.

I slapped this together in about 10 minutes so this is not very reusable – but I thought I would share.

-Andy

Posted in:

Tags:

Comments (2) -

Those odd characters are the UTF-8 Byte Order Mark (BOM).  The XML parsing should be able to handle it.

Reply

Hey Jason,

if I just do a straight cast to XML, it throws errors. I'd love to see/know how to ignore the BOM or just deal with it

-Andy

Reply

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading