Appending the title property of a variable to this string?

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.

If you place your variable you want to expand in quotes you need a subexpression to expand it properly:

$feed | ForEach-Object {"Article Name is: $($_.Title)"}
1 Like