Forum Discussion
O365 Batch Deployment -- OneDrive Auto Configuration
- Feb 14, 2023
You can automate the configuration of OneDrive to sync only the user's Desktop and Documents folder by using the OneDrive client's command-line interface (CLI). You can use the CLI in a batch script to configure OneDrive for each user.
Here's an example of how I would do this:
- Download the OneDrive client: You'll need to download the OneDrive client for your operating system if it is not already installed on the new PC's.
- Open Command Prompt: Open the Command Prompt as an administrator on the new PC.
- Run the following command:
OneDrive.exe /configurepolicies "{\"FilesOnDemandEnabled\":true,\"KnownFolderMoveEnabled\":true,\"KnownFolders\":[{\"Name\":\"Desktop\",\"Target\":\"OneDrive\"},{\"Name\":\"Documents\",\"Target\":\"OneDrive\"}]}"
- Add the command to your batch script: You can add this command to your batch script so that it runs automatically when you deploy OneDrive and the other "standard" programs to the new PC's.
By using the OneDrive CLI in a batch script, you can automate the configuration of OneDrive to sync only the user's Desktop and Documents folder, saving you time and effort. Keep in mind that OneDrive may need to be restarted after the configuration is applied for the changes to take effect.
You can automate the configuration of OneDrive to sync only the user's Desktop and Documents folder by using the OneDrive client's command-line interface (CLI). You can use the CLI in a batch script to configure OneDrive for each user.
Here's an example of how I would do this:
- Download the OneDrive client: You'll need to download the OneDrive client for your operating system if it is not already installed on the new PC's.
- Open Command Prompt: Open the Command Prompt as an administrator on the new PC.
- Run the following command:
OneDrive.exe /configurepolicies "{\"FilesOnDemandEnabled\":true,\"KnownFolderMoveEnabled\":true,\"KnownFolders\":[{\"Name\":\"Desktop\",\"Target\":\"OneDrive\"},{\"Name\":\"Documents\",\"Target\":\"OneDrive\"}]}"
- Add the command to your batch script: You can add this command to your batch script so that it runs automatically when you deploy OneDrive and the other "standard" programs to the new PC's.
By using the OneDrive CLI in a batch script, you can automate the configuration of OneDrive to sync only the user's Desktop and Documents folder, saving you time and effort. Keep in mind that OneDrive may need to be restarted after the configuration is applied for the changes to take effect.