Powershell Invoke-WebRequest with a cookie

Nice and quick post here, mainly so I remember when I need it again, this is a quick sample which shows how to make a web call from PowerShell including a cookie.

Most old methods will suggest using the WebClient object but the new (well newer than the WebClient) Invoke-WebRequest commandlet is a much nicer, in my opinion.

It takes a bit of fooling around to get this up and running so wanted to share.