Closed JonathanPitre closed 2 years ago
You can have a look here to get inspired
Hi Jonathan,
VERBOSE:
Processing Admx files for Microsoft OneDrive
VERBOSE: GET https://go.microsoft.com/fwlink/p/?LinkID=844652 with 0-byte payload
VERBOSE: received 0-byte response of content type
VERBOSE: Found new version 22.111.0522.0002 for 'Microsoft OneDrive'
VERBOSE: Downloading 'https://oneclient.sfx.ms/Win/Prod/22.111.0522.0002/amd64/OneDriveSetup.exe' to 'C:\install\admx\work\\downloads\OneDriveSetup.exe'
VERBOSE: GET https://oneclient.sfx.ms/Win/Prod/22.111.0522.0002/amd64/OneDriveSetup.exe with 0-byte payload
VERBOSE: received 55847320-byte response of content type application/octet-stream
VERBOSE: Installing downloaded OneDrive installer
VERBOSE: Grabbing uninstallation info from registry for OneDrive installer
VERBOSE: Found 'Microsoft OneDrive'
VERBOSE: Grabbing installation path for OneDrive installer
VERBOSE: Found 'C:\Program Files\Microsoft OneDrive\22.111.0522.0002_1'
VERBOSE: Copying Admx files from 'C:\Program Files\Microsoft OneDrive\22.111.0522.0002_1\adm' to 'C:\install\admx\work\\admx\Microsoft OneDrive'
VERBOSE: Copying Admx files from 'C:\Program Files\Microsoft OneDrive\22.111.0522.0002_1\adm' to 'C:\install\admx\store\'
VERBOSE: Uninstalling OneDrive installer
For me, it uninstalls right after copying the admx files. But only if "PreferLocalOneDrive" is false, and OneDrive is not yet installed. If OneDrive is already installed, the script does not uninstall OneDrive.
Can you run it with -Verbose and show your output?
When I use the flag "PreferLocalOneDrive $False" nothing happens, no command is being run.
However, I have not seen any issues with OneDrive installation so far with the latest version.
The parameter -PreferLocalOneDrive does not work, it does not copy the OneDrive.admx to the central policy store
The function Get-OneDriveOnline did not check for the x64 install folder.
Here's the fix:
function Get-OneDriveOnline {
<#
.SYNOPSIS
Returns latest Version and Uri for OneDrive
#>
param (
[bool]$PreferLocalOneDrive
)
if ($PreferLocalOneDrive) {
if (Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\OneDrive" -ErrorAction SilentlyContinue) {
$URI = "$((Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\OneDrive").CurrentVersionPath)"
$Version = "$((Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\OneDrive").Version)"
}
if ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\OneDrive" -ErrorAction SilentlyContinue)) {
$URI = "$((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\OneDrive").CurrentVersionPath)"
$Version = "$((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\OneDrive").Version)"
}
return @{ Version = $Version; URI = $URI }
} else {
try {
$ProgressPreference = 'SilentlyContinue'
$url = "https://go.microsoft.com/fwlink/p/?LinkID=844652"
# grab content without redirecting to the download
$web = Invoke-WebRequest -UseDefaultCredentials -Uri $url -UseBasicParsing -MaximumRedirection 0 -ErrorAction Ignore
# grab uri
$URI = $web.Headers.Location
# grab version
$Version = ($URI | Select-String -Pattern "(\d+(\.\d+){1,4})" -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value }).ToString()
# return evergreen object
return @{ Version = $Version; URI = $URI }
}
catch {
Throw $_
}
}
}
Hi Jonathan,
I added your fix in the DEV branch. Can you see if that works for you?
yep it works
It would be a good idea to uninstall OneDrive once the ADMX files were copied.