OSDeploy / OSDBuilder

PowerShell Module
http://osdbuilder.com
MIT License
193 stars 55 forks source link

Added Conditional Download for OneDrive Setup #54

Open bmkaiser opened 3 years ago

bmkaiser commented 3 years ago

Problem

When using Save-OSDBuilderDownload, OneDriveSetup.exe is always downloaded even if the $GetOSDBuilderPathContentOneDrive directory already has the latest version downloaded (or newer if using the Insider release).

When using New-OSBuild, OneDriveSetup.exe is always copied to the image if it exists in the $GetOSDBuilderPathContentOneDrive directory even if it's an older version than what's already in the image.

Both of these problems introduce unnecessary time and bandwidth usage during the build or content preparation process, and they can lead to scenarios where OneDrive is actually downgraded to an older version.

Solution

To resolve these problems, I created a function in Save-OSDBuilderDownload that only downloads OneDriveSetup.exe if needed and added similar logic to New-OSBuild.

Save-OSDBuilderDownload Change Summary

Scenario 1

Scenario: OneDriveSetup.exe is already downloaded and is the most recent version or newer

Result: OneDriveSetup.exe will not be downloaded

Scenario 2

Scenario: OneDriveSetup.exe is not downloaded or cannot be found

Result: OneDriveSetup.exe will be downloaded

Scenario 3

Scenario: OneDriveSetup.exe is already downloaded, but is not the most recent version

Result: OneDriveSetup.exe will be downloaded

Output

Output for these scenarios will look like this:

PowerShell Prompt

New-OSBuild Change Summary

Scenario 1

Scenario: OneDriveSetup.exe in the content directory is not newer than what's in the image's System directory

Result: OneDriveSetup.exe will not be copied from the content directory to the image's system directory

Output

Output for this scenario will look like this:

PowerShell Prompt