Added Conditional Download for OneDrive Setup #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 toNew-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:
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: