Using Powershell to Generate TinyURLs
Sunday, June 22 2008 - powershell
I cam across a small Powershell function that will allow you to pass a URL to it and it will return a TinyURL.
TinyURL is a web service that provides short aliases for long URLs. Here's a function to generate URL aliases using TinyURL's API. The returned URL is short and never expires.
Here is the function and a small example of how to use it. Thanks to Shay for passing this on.
function New-TinyUrl($url)
{
(new-object net.webclient).downloadString("http://tinyurl.com/api-create.php?url=$url")
}
PS > $vug = New-TinyUrl -url http://marcoshaw.blogspot.com/2008/06/windows-powershell-virtual-user-group.html
PS > $vug
PS > http://tinyurl.com/4k9ons
PS > (new-object -com shell.application).open($vug)
Here is the link to the original post.
