Skip to content

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

@frippe75

Description

@frippe75

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
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions