Learn about Windows PowerShell
Summary: Use Windows PowerShell to easily find blog posts via RSS.
How can I use Windows PowerShell to find a list of Hey, Scripting Guy! Blog posts without a lot of development work?
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
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 yourcredentials 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 BrownI 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 woofWhat I did was add the "UseDefaultCredentials" parameter $uri = "http://blogs.technet.com/b/heyscriptingguy/atom.aspx" (Invoke-RestMethod $uri -UseDefaultCredentials).titleWorked perfectly for me.
@ScarBod : Thanks. Worked for me, too.