OSDUpdate icon indicating copy to clipboard operation
OSDUpdate copied to clipboard

ER: Using the Bits cmdlets makes OSDUpdate non-crossplatform switch to Invoke-WebRequest

Open frippe75 opened this issue 3 years ago • 1 comments

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
}

frippe75 avatar Apr 23 '22 06:04 frippe75

I'll look into making this change after MMSMOA

OSDeploy avatar Apr 26 '22 03:04 OSDeploy