Skip to content

Instantly share code, notes, and snippets.

@maldevel
Created May 30, 2018 13:49
Show Gist options
  • Save maldevel/2f44858adf86a321a8c81378e9382b13 to your computer and use it in GitHub Desktop.
Save maldevel/2f44858adf86a321a8c81378e9382b13 to your computer and use it in GitHub Desktop.
Get HTTP headers using PowerShell
param(
[Parameter(ValueFromPipeline=$true)]
[string] $Url
)
$request = [System.Net.WebRequest]::Create($Url); $headers = $request.GetResponse().Headers; $headers.AllKeys | Select-Object @{ Name = "Key"; Expression = { $_ }}, @{ Name = "Value"; Expression = { $headers.GetValues( $_ )}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment