This is going to be a quick post on how to backup a single OneDrive folder with Veeam Backup for Office 365. One of my customers developed an internal policy regarding the usage of OneDrive for Business. The policy is, that each user has a specific “Work” folder (root folder) which gets backed up with Veeam Backup for Office 365. All other folders are not backed up and the users know that. So in this scenario we needed a OneDrive backup job, which backs up the whole organization with the OneDrive object and only includes that work folder. By the way, you are also able to exclude specific OneDrive folders by using the “-ExcludedOneDriveFolders” variable. However, in my case here it makes more sense to only include that specific folder.
I recreated that scenario with my own Office 365 Tenant, whereby I selected to only backup my webhosting folder. If you didn’t know it already, the ability to exclude or include specific folders for OneDrive backups is only available by using PowerShell. Here is the related command and its parameters.
So what I did is the following:
$Organization = Get-VBOOrganization -Name "office365.virtualhome.blog"
$Repository = Get-VBORepository -Name "ONEDRIVE"
$ItemToBackup = New-VBOBackupItem -Organization $Organization -OneDrive
Add-VBOJob -Organization $Organization -Name "ONEDRIVE BACKUP" -Repository $Repository -SelectedItems $ItemToBackup -SelectedOneDriveFolder "Falko Banaszak Webhosting"
I created some variables for the organization, the repository and the item I wanted to back up. With the “-SelectedOneDriveFolder” parameter, I’ve set the job to only process the folder “Falko Banaszak Webhosting”.
After my job has been successfully created, I created another variable for my new job and started it immediately:
$BackupJob = Get-VBOJob -Name "ONEDRIVE BACKUP"
Start-VBOJob -Job $BackupJob
Remember: If you start a job in PowerShell, you have to wait until it is finished. If you do not wait, it cancels the job.
So I waited until the job was finished.
After the job completed successfully, I checked the Veeam Explorer for OneDrive.
Finally, you can see, that the job was succesful and did only backup the “Falko Banaszak Webhosting” folder.
As always, thanks for reading and have a great time!