Commit 27c5c1b1 authored by Jos Lieben's avatar Jos Lieben

also optionally configure Files On Demand if specified

parent 33a87b28
......@@ -17,6 +17,7 @@
#REQUIRED CONFIGURATION:
$copyExistingFiles = $False #use with caution! Could take a long time and does not resist a reboot
$redirectFoldersToOnedriveForBusiness = $True #if enabled, the next array needs to be configured as well
$enableFilesOnDemand = $True #Requires Windows 10 1709 or higher
$listOfFoldersToRedirectToOnedriveForBusiness = @(#One line for each folder you want to redirect. For knownFolderInternalName choose from Get-KnownFolderPath function, for knownFolderInternalIdentifier choose from Set-KnownFolderPath function
@{"knownFolderInternalName" = "Desktop";"knownFolderInternalIdentifier"="Desktop";"desiredSubFolderNameInOnedrive"="Desktop"},
@{"knownFolderInternalName" = "MyDocuments";"knownFolderInternalIdentifier"="Documents";"desiredSubFolderNameInOnedrive"="My Documents"},
......@@ -82,6 +83,9 @@ try{
Write-Output "Adding registry keys for Onedrive"
$res = New-Item -Path "HKLM:\Software\Policies\Microsoft\Onedrive" -Force -Confirm:$False -ErrorAction SilentlyContinue
$res = New-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Onedrive" -Name SilentAccountConfig -Value 1 -PropertyType DWORD -Force -ErrorAction Stop
if($enableFilesOnDemand){
$res = New-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Onedrive" -Name FilesOnDemandEnabled -Value 1 -PropertyType DWORD -Force -ErrorAction Stop
}
Write-Output "Registry keys for Onedrive added"
}catch{
Write-Error "Failed to add Onedrive registry keys, installation may not be consistent" -ErrorAction Continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment