1

#PSTip Get PowerShell Magazine’s daily tips right from your console!

Our editors at the PowerShell Magazine are doing a great job pushing daily PowerShell tips and tricks to our readers. Now, wouldn’t it be great if you can get access to these tips right from your console?

Yes, it is easy. In fact, PowerShell 3.0 makes it way too easy. Check this:

Function Get-PSTip {
	param (
		[switch]$Multiple
	)

	$url = Invoke-RestMethod -Uri "http://bit.ly/QwjgRd"

	if ($Multiple) {
		$selectedTips = $url | Select-Object Title, Link | Out-GridView -PassThru
		if ($selectedTips) {
			$selectedTips | Foreach-Object {
				Start-Process $_.Link
			}
		}
	} else {
		Start-Process $url[0].Link
	}
}

This is it. Add this simple code snippet to your PowerShell profile and then every time you run, Get-PSTip, you will have the latest tip served right from your console or PowerShell ISE prompt. Also, you can use Get-PSTip with -Multiple parameter to select a tip from the list and open that in browser.

Filed in: Columns, Tips and Tricks Tags: , , ,

One Response to "#PSTip Get PowerShell Magazine’s daily tips right from your console!"

  1. Vijay says:

    Do we need any credentials to access the URI? this is the error I receive…

    PS C:\Users\vijred> Get-PSTip
    Invoke-RestMethod :
    Access Denied (authentication_failed)
    Your credentials could not be authenticated: “Credentials are missing.”. You will not be permitted access until your
    credentials can be verified.
    This is typically caused by an incorrect username and/or password, but could also be caused by network problems.
    For assistance, contact your network support team.
    At line:5 char:11
    + $url = Invoke-RestMethod -Uri “http://bit.ly/QwjgRd”

Leave a Reply

Submit Comment

© 2017 PowerShell Magazine. All rights reserved. XHTML / CSS Valid.
Proudly designed by Theme Junkie.
%d bloggers like this: