Solved

Restoring OneDrive via PowerShell cannot find Online library


Userlevel 4

I’m using Veeam Backup for Microsoft Office 365 version 4.0 and want to copy all of the OneDrive data from users into their new accounts

 

$DestinationSubfolder = 'Restored Work'
$VeeamBackupJobName = 'BMC_M365_Data'
$M365Credentials = Get-Credential
$Job = Get-VBOjob -Name $VeeamBackupJobName
$Session = Start-VEODRestoreSession -Job $Job -LatestState
$UserToRestore = Get-VEODUser -Session $Session -Name 'Joe Bloggs'
$UserDocuments = Get-VEODDocument -User $UserToRestore
if($UserDocuments)
{
$TargetUserName = 'Joe Bloggs 2'
Restore-VEODDocument -User $UserToRestore -RestoreChangedItems -RestoreDeletedItems -Credential $M365Credentials -TargetUser $TargetUserName -TargetFolder $DestinationSubfolder
}
Else
{
'No OneDrive content found.'
}
Get-VEODRestoreSession | Stop-VEODRestoreSession

 

The commands return this error though:

“Restore-VEODDocument : Failed to find Online OneDrive library for: Joe Bloggs 2”

I’ve added the second account to the original backup job to ensure Veeam can see it. Any idea what the problem might be?

Thanks.

icon

Best answer by MicoolPaul 17 May 2023, 16:20

View original

4 comments

Userlevel 7
Badge +20

First things first, you should test this in the latest version, which is currently VB365 v7, there’ve been many breaking changes over the years. If you can test in a supported version that the issue still occurs and if the error changes that’ll be the best first step please.

Userlevel 4

Thanks for the suggestion. I’ve actually got it working in the meantime by testing the backup in the GUI. Once I did that, the PS version worked fine.

So, I guess Veeam “couldn’t see” my target user, for want of a better word? Is there something I should do to ensure that? This morning I used Get-VEODUser to check the account and I could query it without issue. Any suggestions?

Cheers again.

Userlevel 7
Badge +7

Hi @KWCork 

It might be worth running ‘Get-VEODUser’ first to get a list of the users and then perform the restore. That way, you will have a list of the users before beginning the restore session. 

Userlevel 4

First things first, you should test this in the latest version, which is currently VB365 v7, there’ve been many breaking changes over the years. If you can test in a supported version that the issue still occurs and if the error changes that’ll be the best first step please.

I’ve just now had a chance to install a trial of version 7, and yup, that works no problem.

Cheers!

Comment