Skip to content

Instantly share code, notes, and snippets.

@davewilson
Last active January 30, 2018 15:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davewilson/6b16abe50ac27bc1c200 to your computer and use it in GitHub Desktop.
Save davewilson/6b16abe50ac27bc1c200 to your computer and use it in GitHub Desktop.
<#
.Synopsis
Expands a shortened URL to its full URL
.DESCRIPTION
Expands a shortened URL to its full URL
.EXAMPLE
Get-FullURL http:/bit.ly/12345
#>
function Get-FullURL
{
Param
(
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
$url
)
(Invoke-WebRequest -uri $url -MaximumRedirection 0 -ErrorAction Ignore).Headers.Location
}
@davewilson
Copy link
Author

Fixed trailing space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment