PowerTip: Use PowerShell to Find Blog Posts

PowerTip: Use PowerShell to Find Blog Posts

  • Comments 6
  • Likes

Summary: Use Windows PowerShell to easily find blog posts via RSS.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find a list of Hey, Scripting Guy! Blog posts without
          a lot of development work?

Hey, Scripting Guy! Answer Use the Invoke-RestMethod cmdlet and specify the URI for the Hey, Scripting Guy! Blog RSS feed:

$uri = http://blogs.technet.com/b/heyscriptingguy/atom.aspx

(Invoke-RestMethod $uri).title

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • I had to put quotation marks around the URI before this would work for me.

    Otherwise ISE says:

    http://blogs.technet.com/b/heyscriptingguy/atom.aspx : The term 'http://blogs.technet.com/b/heyscriptingguy/atom.aspx' is not recognized as the name of a cmdlet, function, script file, or operable
    program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:8
    + $uri = http://blogs.technet.com/b/heyscriptingguy/atom.aspx
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (http://blogs.te...ngguy/atom.aspx:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  • I too had to enclose the url in quotation marks. But running Invoke-RestMethod failed for me:

    Access Denied (authentication_failed)
    Your credentials could not be authenticated: "Credentials are missing.". You will not be permitted access until your
    credentials can be verified.
    This is typically caused by an incorrect username and/or password, but could also be caused by network problems.
    For assistance, contact your network support team.

  • Same here.

    Without the quotes it throws an error "The term 'http://blogs.technet.com/b/heyscriptingguy/atom.aspx' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

  • @James Brown
    I basically got something like that myself

    Invoke-RestMethod :
    This Page Cannot Be Displayed
    Authentication is required to access the requested web site
    bla bla woof woof

    What I did was add the "UseDefaultCredentials" parameter

    $uri = "http://blogs.technet.com/b/heyscriptingguy/atom.aspx"
    (Invoke-RestMethod $uri -UseDefaultCredentials).title

    Worked perfectly for me.

  • @ScarBod : Thanks. Worked for me, too.