Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Browse TrainSignal Courses with PowerShell

Posted on June 5, 2013June 5, 2013

talkbubble-v3It took longer than I expected, but my latest course for TrainSignal is now available. PowerShell v3 Essentials is targeted for IT Pros with little to no PowerShell experience. This is the course that will get you up and running in short order. I developed the course so that an IT Pro could be effective with the PowerShell console, using many of the new features found in PowerShell 3.0. One of those features is the Invoke-WebRequest cmdlet. I thought I'd share a version of a demonstration I did for the course on using Invoke-WebRequest to browse the TrainSignal course catalog.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

In case you didn't know, all of TrainSignal's courses are now delivered online on a monthly subscription basis starting at $49/month. Their site has all the pricing information you need. But you can also start with a 3 day free trial. Oh, and lessons can be viewed offline as well. Anyway...using Invoke-WebRequest I can "scrape" the TrainSignal courseware page using PowerShell. Here's my sample script.

#requires -version 3.0

<#
 a version of a demo from my PowerShell 3 course
 https://www.trainsignal.com/course/209/powershell-v3-essentials

 Do NOT run this in the PowerShell ISE as there is a memory bug
 with Invoke-WebRequest
#>

$base = "http://trainsignal.com"
$uri = "$base/Browse"
$r = Invoke-WebRequest $uri

<# 
look at links if you want
$r.links[0..5]
$r.links | select OuterText,href
#>

#let's get just courses
$courses = $r.links | where {$_.href -match "^/Course"} 

#format course data
$data = $courses |
Select @{Name="Title";Expression={$_.OuterText.Split("`n")[0].Trim()}},
@{Name="Instructor";Expression={$_.OuterText.Split("`n")[1].Trim()}},
@{Name="Date";Expression={$_.OuterText.Split("`n")[2].Trim() -as [datetime]}},
@{Name="Link";Expression={"$base$($_.href)"}} 

#send the data to Out-Gridview 
$data | 
Out-GridView -Title "Trainsignal Courses: select one or more courses" -PassThru |
Foreach { 
 #open selected links in the browser
 start $_.link
}

#end of script

The script saves the results from Invoke-WebRequest to a variable. In looking through the raw html I learned how the links were formatted and discovered that I only wanted links that started with /Course. I also figured out that the link objects had instructor and course information that could be parsed out of the OuterText property so I reformat the data into something more object-like.

I did this so that I could push the results to Out-Gridview displaying the courses.

get-trainsignalIn PowerShell 3, Out-Gridview can pass objects back to the pipeline, so I can select a few courses that look interesting, click OK, and the links will open up in my web browser.

I had a lot of fun creating this course and hope you find it worth your investment. Let me know what you think. And if there is a course you'd like to see me create, especially PowerShell related, let me know that too.

 


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

2 thoughts on “Browse TrainSignal Courses with PowerShell”

  1. Pingback: Microsoft Most Valuable Professional (MVP) – Best Posts of the Week around Windows Server, Exchange, SystemCenter and more – #32 - Dell TechCenter - TechCenter - Dell Community
  2. Pingback: Microsoft Most Valuable Professional (MVP) – Best Posts of the Week around Windows Server, Exchange, SystemCenter and more – #32 - TechCenter - Blog - TechCenter – Dell Community

Comments are closed.

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d