Building Windows images on Linux using Packer. Tried using OSDUpdate which looks like a really nice util but is stuck upon it being based on Start-BitsTransfer from the BitsTransfer module.
I guess I could fix it by replacing with
Invoke-WebRequest -Uri $source -OutFile $destination
But would be rather nice to be able to avoid relying on that module.
Or maybe a switch to select between the two. Or even check if BitsTransfer is missing and fallback to Invoke-WebRequest
This worked for me:
if (Get-Command | Where-Object Source -EQ 'BitsTransfer') {
Start-BitsTransfer -Source $DownloadUrl -Destination $DownloadFile
} else {
Invoke-WebRequest -Uri$DownloadUrl -Outfile $DownloadFile
}