clear Function Get-TinyURL { #PowerShell - Get-TinyURL API Call param ( [Parameter(Mandatory=$true,ValueFromPipeline=$true)] [String] $sHTTPLink ) if ($sHTTPLink.StartsWith("http://") -eq $true -or $sHTTPLink.StartsWith("https://") -eq $true) { if ($WebClient -eq $null) {$Global:WebClient=new-object System.Net.WebClient } $webClient.DownloadString("http://tinyurl.com/api-create.php?url=" + [System.Web.HttpUtility]::UrlEncode($sHTTPLink)) } else { Write-Output "Bad Link, please include http:// or https://" } } Get-TinyURL "http://google.com"
GitHub: https://gist.github.com/dkittell/d11d6bf7ac03d5c52355
Last Updated on February 12, 2016