1

I may be using the wrong terminology here, please beer with me.

I have an RSS Feed link here. I’ve run it against Invoke-RestMethod and stored it in a variable called $Feed.

If I run :

$feed | Format-Table -Property Title, Link

I get the data presented nicely like this:

enter image description here

I would like to print out the all the Titles on the Terminal Prefixing the string Article Name is: . One article per line. For example:

Article Name is: Fan Art Can Be a Good Thing 

Here is what I have so far.

$feed = Invoke-RestMethod https://www.muddycolors.com/feed/
$feed | ForEach-Object {"Article Name is: $_.Title"}

Terminal Outputs:

Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title
Article Name is: System.Xml.XmlElement.Title

What could I be doing wrong? Any help would be appreciated.

Netmano93
  • 75
  • 1
  • 7
  • In short: In order to embed _expressions_ in an expandable string (`"..."`), you must enclose them in `$(...)`. Notably, this includes property and indexed access (e.g., `$($var.property)`, `$($var[0])`). Only variables _as a whole_ do not require this (e.g., `$var`, `$env:USERNAME`). See [this answer](https://stackoverflow.com/a/40445998/45375) to the linked duplicate. – mklement0 Jul 15 '21 at 21:23

0 Answers0