Download archive-file with Powershell's Invoke-WebRequest

Hello,

while trying to write a good (brief but thorough) question I found the answer by myself:

$basicAuthValue = "Basic {0}" -f [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes('user:password'))
Invoke-WebRequest -Uri https://my.domain/owner/repo/archive/master.zip -OutFile "$env:USERPROFILE\Downloads\repo.zip" -Headers @{Authorization = $basicAuthValue}

I’ve found the solution actually on Stackoverflow: https://stackoverflow.com/a/27951845/1547831

With curl - who would have expected that - it’s of course way easier:

curl -u 'user:password' https://my.domain/owner/repo/archive/master.zip > repo.zip

Thought I’d share it in case the question occurs to someone else.