Question

Restoring OneDrive via PowerShell cannot find Online library


Userlevel 2
  • Not a newbie anymore
  • 3 comments

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.


3 comments

Userlevel 7
Badge +17

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 2

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 +6

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. 

Comment