A new PowerShell background thread can do things for you in the background, for example updating your PowerShell window title bar with new news feeds every five seconds.
First, let’s look at how to get to the news feed items:
$RSSFeedUrl = 'https://www.technologyreview.com/stories.rss' $xml = Invoke-RestMethod -Uri $RSSFeedUrl $xml | ForEach-Object { "{0} {1}" -f $_.title, $_.description }
Feel free to adjust the RSS ticker URL. If you do, also adjust the property names “title” and “description”. Each RSS ticker can name these properties freely.
And here is the complete solution that adds the news items to your title bar:
$Code = { # receive the visible PowerShell window reference param($UI) # get RSS feed messages $RSSFeedUrl = 'https://www.technologyreview.com/stories.rss' $xml = Invoke-RestMethod -Uri $RSSFeedUrl # show a random message every 5 seconds do { $message = $xml | Get-Random $UI.WindowTitle = "{0} {1}" -f $message.title, $message.description Start-Sleep -Seconds 5 } while ($true) } # create a new PowerShell thread $ps = [PowerShell]::Create() # add the code, and a reference to the visible PowerShell window $null = $ps.AddScript($Code).AddArgument($host.UI.RawUI) # launch background thread $null = $ps.BeginInvoke()