Creating TinyURLs

by Sep 25, 2014

All PowerShell Versions

You probably have heard about shortening long URLs. There are plenty of free services available. Here is a script that turns any URL into a tiny URL:

$OriginalURL = 'http://www.powertheshell.com/isesteroids2'

$url = "http://tinyurl.com/api-create.php?url=$OriginalURL"
$webclient = New-Object -TypeName System.Net.WebClient
$webclient.DownloadString($url) 

Simply assign the URL you want to shorten to the variable $OriginalURL. Then run the script. It will return the shortened URL that you then can use to navigate.

Twitter This Tip! ReTweet this Tip!