Powershell script to search for “How Do I”-video’s for NAV 2013 (R2)

As you might know, lately, I have been working on the “How Do I”-video-series about various topics regarding Microsoft Dynamics NAV 2013. these video’s are posted on MSDN, PartnerSource and Youtube. (And hereby, you got the links to easily find them – bookmark them, please :-)).

Now, as you migth have noticed, me personally, I have been doing some video’s on Powershell. Namely:

And there are a number of other video’s where I use powershell as well (managing companies,managing users,migrating to multi-tenancy, …).

PowerShell.com

When I started out with powershell, a colleague pointed me to the site: http://powershell.com/cs/ . I immediately joined, and never regreted ever since. You can subscribe to the “PowerTip of the day” with very useful tips .. that really get you going in certain domains .. to do some really clever powershell stuff. Remember that there is PowerShell capabilities in Windows 8 as well! And as Freddy would call it: PowerShell is “Bat-files on steroids..” .. I really like that expression!

Nevertheless, Powershell.com really helped me in the entire NAV-on-PowerShell story as well.

Find YouTube video’s with PowerShell

Not too long ago, I received this PowerTip: Search and View powerShell video’s. Well, isn’t that just perfect? A PowerShell script to find video’s to get you started with PowerShell.. .

Well .. this deserved some modification to provide you a way to search for video’s on NAV 2013 :-). I modified some bits and bytes of the script, to find the “How Do I”-video’s that Microsoft posts on youtube in its channel. Here you go:

$keyword = '"How Do I:"+NAV+2013'
 Invoke-RestMethod -Uri "https://gdata.youtube.com/feeds/api/videos?v=2&q=$($keyword)&max-results=50&author=msdyncomm" |
 Select-Object -Property Title, @{N='Author';E={$_.Author.Name}}, @{N='Link';E={$_.Content.src}}, @{N='Updated';E={[DateTime]$_.Updated}}, @{N='Views';E={$_.Statistics.viewCount}} |
 Sort-Object -Property Updated -Descending |
 Out-GridView -Title "Select your '$Keyword' video, then click OK to view." -PassThru |
 ForEach-Object { Start-Process $_.Link }

When you look at it closely .. you’ll notice it’s quite an interesting example on how to use piping in powershell, isn’t it? In fact, except from the variable declaration, it’s just a oneliner! It’s generally going to use the RSS feed of youtube, filter it on Microsoft’s channel, take as many results as possible (couldn’t get more then 50), put that into a grid, and make it possible for you to select on, click OK and start the video!

The result will be a grid like this, where you can select a movie, which will start playing after you clicked “OK”


How cool is that? 🙂

Ok ok, I admit, it’s a bit playing around with PowerShell .. and you must be wondering how this would be useful to you. Well, if you just put the script into a textfile, call it “HowDoI.ps1”, and place it somewhere where you can easily find it (desktop?) .. then you always have it by hand:


The feed

At least, that’s what I do now .. :-). Another way to easily go to the How Do I video’s is obviously the same feed that I’m using in this powershell script. Which I guess makes sense to share as well ;-):

https://gdata.youtube.com/feeds/api/videos?v=2&q=”How Do I:”+NAV+2013&max-results=50&author=msdyncomm

Now I definitely shared all the ways to get to the How Do I video’s.. hope it finds you well!

Enjoy!

5.00 avg. rating (97% score) - 1 vote

Permanent link to this article: https://www.waldo.be/2014/02/03/powershell-in-the-how-do-i-series-for-nav-2013-r2/

2 comments

5 pings

  1. In some cases, there is a bug in the invoke-restmethod. Then only every other row is returned instead of all rows.
    (https://connect.microsoft.com/PowerShell/feedback/details/691723/ps3ctp1-invoke-restmethod-fails-to-return-the-entire-output)

    Microsoft suggests to use the invoke-webrequest method instead. So below is an updated version of your script for anyone who is interested.

    $keyword = ‘”How Do I:”+NAV+2013′
    $url = “https://gdata.youtube.com/feeds/api/videos?v=2&q=$($keyword)&max-results=50&author=msdyncomm”

    $wc = New-Object Net.WebClient
    [xml]$xml=$wc.DownloadString($url)
    $xml.feed.entry |
    Select-Object -Property Title, @{N=’Author’;E={$_.Author.Name}}, @{N=’Link’;E={$_.Content.src}}, @{N=’Updated’;E={[DateTime]$_.Updated}}, @{N=’Views’;E={$_.Statistics.viewCount}} |
    Sort-Object -Property Updated -Descending |
    Out-GridView -Title “Select your ‘$Keyword’ video, then click OK to view.” -PassThru |
    ForEach-Object { Start-Process $_.Link }

    Regards,
    Joachim

      • waldo on February 4, 2014 at 2:01 pm
        Author

      Thanks, dear colleague ;-).

  1. […] Bron : Waldo’s Blog Lees meer… […]

  2. […] me, the powershell that I wrote works pretty well, as it’s sorting on the release date: I immediately see the new ones on […]

  3. […] me, the powershell that I wrote works pretty well, as it’s sorting on the release date: I immediately see the new ones on […]

  4. […] me, the powershell that I wrote works pretty well, as it’s sorting on the release date: I immediately see the new ones on […]

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.