- 
				ereynolds
 - Novice
 - Posts: 4
 - Liked: never
 - Joined: Aug 28, 2020 1:14 am
 - Full Name: Edward Reynolds
 - Contact:
 
Restore entire o365 mailbox using powershell.
Looking to automate the restoration of a mailbox via Veeam Backup for Microsoft Office 365.
In my test case I would like to restore mailbox "A" to mailbox "B"
I attempted to use Restore-VEXItem, but get errors...
Import-Module Veeam.Exchange.PowerShell
$org = Get-VBOOrganization -Name "O365Org"
$sourceUser = Get-VBOOrganizationUser -Organization $org -UserName "a@domain.com"
$targetUser = Get-VBOOrganizationUser -Organization $org -UserName "b@domain.com"
Restore-VEXItem -Mailbox $sourceUser -TargetMailbox $targetUser
Error:
Restore-VEXItem : Cannot bind parameter 'Mailbox'. Cannot convert the "Veeam.Archiver.PowerShell.Model.VBOOrganizationUser" value of type
"Veeam.Archiver.PowerShell.Model.VBOOrganizationUser" to type "Veeam.Exchange.PowerShell.Model.Items.VEXMailbox".
At line:1 char:26
+ Restore-VEXItem -Mailbox $sourceUser -TargetMailbox $targetUser
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Restore-VEXItem], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Veeam.Exchange.PowerShell.Cmdlets.Restore.RestoreVEXItem
Any suggestions would be great.
Cheers!
Ed.
			
			
									
						
										
						In my test case I would like to restore mailbox "A" to mailbox "B"
I attempted to use Restore-VEXItem, but get errors...
Import-Module Veeam.Exchange.PowerShell
$org = Get-VBOOrganization -Name "O365Org"
$sourceUser = Get-VBOOrganizationUser -Organization $org -UserName "a@domain.com"
$targetUser = Get-VBOOrganizationUser -Organization $org -UserName "b@domain.com"
Restore-VEXItem -Mailbox $sourceUser -TargetMailbox $targetUser
Error:
Restore-VEXItem : Cannot bind parameter 'Mailbox'. Cannot convert the "Veeam.Archiver.PowerShell.Model.VBOOrganizationUser" value of type
"Veeam.Archiver.PowerShell.Model.VBOOrganizationUser" to type "Veeam.Exchange.PowerShell.Model.Items.VEXMailbox".
At line:1 char:26
+ Restore-VEXItem -Mailbox $sourceUser -TargetMailbox $targetUser
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Restore-VEXItem], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Veeam.Exchange.PowerShell.Cmdlets.Restore.RestoreVEXItem
Any suggestions would be great.
Cheers!
Ed.
- 
				Polina
 - Veeam Software
 - Posts: 3768
 - Liked: 923 times
 - Joined: Oct 21, 2011 11:22 am
 - Full Name: Polina Vasileva
 - Contact:
 
Re: Restore entire o365 mailbox using powershell.
Hi Ed,
For restore, you need to start a restore session and get the mailbox from your VBO backup database (while you're getting a user from an organization added to the VBO scope).
			
			
									
						
										
						For restore, you need to start a restore session and get the mailbox from your VBO backup database (while you're getting a user from an organization added to the VBO scope).
- 
				nielsengelen
 - Product Manager
 - Posts: 6100
 - Liked: 1272 times
 - Joined: Jul 15, 2013 11:09 am
 - Full Name: Niels Engelen
 - Contact:
 
Re: Restore entire o365 mailbox using powershell.
To get you started:
$mailbox will contain every mailbox then and u can continue with Restore-VEXItem to perform the actual restore from there.
			
			
									
						
							Code: Select all
Import-Module "Veeam.Archiver.PowerShell.psd1"
Import-Module "Veeam.Exchange.PowerShell"
$session = Start-VBOExchangeItemRestoreSession -LatestState
$database = Get-VEXDatabase -Session $session
$mailbox = Get-VEXMailbox -Database $databaseGitHub: https://github.com/nielsengelen
			
						- 
				ereynolds
 - Novice
 - Posts: 4
 - Liked: never
 - Joined: Aug 28, 2020 1:14 am
 - Full Name: Edward Reynolds
 - Contact:
 
Re: Restore entire o365 mailbox using powershell.
Thank you!
Appreciate the help!
In regards to archive mailboxes, I can select the user "A" archive as the source by using:
$mailbox = Get-VEXMailbox -Database $database -Name "In-Place Archive - A"
But how can I select the target destination of user "B" Archive?
Restore-VEXItem -Mailbox $mailbox -TargetMailbox b@domain.com -RestoreChangedItem -Credential $Cred
Kind Regards,
Ed.
			
			
									
						
										
						Appreciate the help!
In regards to archive mailboxes, I can select the user "A" archive as the source by using:
$mailbox = Get-VEXMailbox -Database $database -Name "In-Place Archive - A"
But how can I select the target destination of user "B" Archive?
Restore-VEXItem -Mailbox $mailbox -TargetMailbox b@domain.com -RestoreChangedItem -Credential $Cred
Kind Regards,
Ed.
- 
				ereynolds
 - Novice
 - Posts: 4
 - Liked: never
 - Joined: Aug 28, 2020 1:14 am
 - Full Name: Edward Reynolds
 - Contact:
 
Re: Restore entire o365 mailbox using powershell.
I think the answer is I can't restore direct to a users Archive, as it's not directly accessible. 
Instead I believe I would need to restore the data to the users mailbox and apply archive policy.
Kind Regards,
Ed.
			
			
									
						
										
						Instead I believe I would need to restore the data to the users mailbox and apply archive policy.
Kind Regards,
Ed.
- 
				nielsengelen
 - Product Manager
 - Posts: 6100
 - Liked: 1272 times
 - Joined: Jul 15, 2013 11:09 am
 - Full Name: Niels Engelen
 - Contact:
 
Re: Restore entire o365 mailbox using powershell.
Correct, restore to the archive is not possible.
			
			
									
						
							GitHub: https://github.com/nielsengelen
			
						- 
				ereynolds
 - Novice
 - Posts: 4
 - Liked: never
 - Joined: Aug 28, 2020 1:14 am
 - Full Name: Edward Reynolds
 - Contact:
 
Re: Restore entire o365 mailbox using powershell.
Thank you for your assistance!
Very much appreciated!!
Kind Regards,
Ed.
			
			
									
						
										
						Very much appreciated!!
Kind Regards,
Ed.
Who is online
Users browsing this forum: Bing [Bot] and 24 guests