Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's SharePoint Admin Blog > Posts > Resolve Short URLs with PowerShell
May 19
Resolve Short URLs with PowerShell

The Internet wouldn’t work if it weren’t for Short URLs. How else would we efficiently share our funny cat videos? I’ve written a couple of blog posts on them myself. Handy little devils, aren’t they? 

One downside of them is you don’t know where they’re going to lead you. That innocent looking bit.ly link could take you to some amazing bit of wisdom on the internet, sure. But short URLs can have a dark side, too. The payload waiting for you on the other side of that t.co link could also be a Rick Astley video, you just never know.

Being a generally untrusting person, I always hesitate to click URLs if I don’t know exactly where they are going. But then I started feeling like I was missing out on stuff. That’s when I put my thinking cap on and wrote this little PowerShell gem:

$url = “https://www.toddklindt.com/sp2016builds”

((Invoke-WebRequest -UseBasicParsing –Uri $url).baseresponse).ResponseUri

This little beauty will take a short URL for any of the common shorteners and tell you what it resolves to. Here it is in action.

image

The URL at the top is the short URL we want to check, and the circled URL below is the secret URL it’s forwarding you to. If you decide it is safe, you can type start $url in PowerShell and it will open up in your default browser.

Once again, PowerShell comes to the rescue. I hope this helps a few of you explore short URLs without fear, and without having to listen to Rick Astley, unless you want to of course.

tk

ShortURL: https://www.toddklindt.com/PoshResolveShortURLS

Comments

There are no comments for this post.

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 Please Support my Sponsors