Maintain control of your Microsoft Office 365 email data
Post Reply
Robvil
Expert
Posts: 129
Liked: 13 times
Joined: Oct 03, 2016 12:41 pm
Full Name: Robert
Contact:

Powershell

Post by Robvil » Sep 05, 2018 8:38 am

Hi,

What am i doing wrong here?

Get-VBORepository


Id : f54478c5-c1ee-456c-bf2f-20ecd1780c50
Name : Office365-Email-Backup
Path : F:\O365-Email-Backup
Capacity :
FreeSpace :
RetentionPeriod : Keep forever
RetentionFrequencyType : Daily
DailyTime : 00:00:00
DailyType : Everyday

$repository = Get-VBORepository -Name "Office365-Email-Backup"
$user = Get-VBOEntityData -Type User -Repository $repository -Name "Jesper Hagstrøm"
Remove-VBOEntityData -Repository $repository -User $user -Mailbox -ArchiveMailbox -OneDrive -Sites -WhatIf

gives me:

Remove-VBOEntityData : Cannot convert 'System.Object[]' to the type 'Veeam.Archiver.PowerShell.Cmdlets.DataManagement.VBOUserData' required by parameter 'User'. Specifie
d method is not supported.
At C:\Users\admin-rv\Desktop\Delete VBO archive user data.ps1:3 char:52
+ Remove-VBOEntityData -Repository $repository -User $user -Mailbox -ArchiveMailbo ...
+ ~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-VBOEntityData], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Veeam.Archiver.PowerShell.Cmdlets.BackupItems.RemoveVBOEntityData

/Robert

Vasiliy.Semendiy
Veeam Software
Posts: 4
Liked: never
Joined: Jul 07, 2017 8:36 am
Full Name: Vasiliy.Semendiy
Contact:

Re: Powershell

Post by Vasiliy.Semendiy » Sep 05, 2018 10:48 am

Hello!

There are three variants of using this command:
1. Remove-VBOEntityData -Repository <VBORepository> -User <VBOUserData> [-Mailbox <SwitchParameter>] [-ArchiveMailbox <SwitchParameter>] [-OneDrive <SwitchParameter>] [-Sites <SwitchParameter>] [-WhatIf <SwitchParameter>] [-Confirm <SwitchParameter>] [<CommonParameters>]
2. Remove-VBOEntityData -Repository <VBORepository> -Group <VBOGroupData> [-Mailbox <SwitchParameter>] [-ArchiveMailbox <SwitchParameter>] [-OneDrive <SwitchParameter>] [-Sites <SwitchParameter>] [-GroupMailbox <SwitchParameter>] [-GroupSite <SwitchParameter>] [-WhatIf <SwitchParameter>] [-Confirm <SwitchParameter>] [<CommonParameters>]
3. Remove-VBOEntityData -Repository <VBORepository> -Site <VBOSiteData> [-WhatIf <SwitchParameter>] [-Confirm <SwitchParameter>] [<CommonParameters>]

You tried to use the first one.

The message you received indicates that there is an array in $User. This is incorrect in terms of the syntax of the command.

Can you show what Get-VBOEntityData -Type User -Repository $repository -Name "Jesper Hagstrøm" returns?

Robvil
Expert
Posts: 129
Liked: 13 times
Joined: Oct 03, 2016 12:41 pm
Full Name: Robert
Contact:

Re: Powershell

Post by Robvil » Sep 05, 2018 12:25 pm

PS C:\Users\admin-rv> $repository = Get-VBORepository -Name "Office365-Email-Backup"
PS C:\Users\admin-rv> Get-VBOEntityData -Type User -Repository $repository -Name "Jesper Hagstrøm"


DisplayName : Jesper Hagstrøm
Email : jh@kaufmann.dk
ArchiveName :
OneDriveUrl : {}
PersonalSiteUrl : {}
AccountType : User
Organization : AxelKaufmann.onmicrosoft.com

DisplayName : Jesper Hagstrøm
Email : jh@kaufmann.dk
ArchiveName :
OneDriveUrl : {}
PersonalSiteUrl : {}
AccountType : User
Organization : AxelKaufmann.onmicrosoft.com

Vasiliy.Semendiy
Veeam Software
Posts: 4
Liked: never
Joined: Jul 07, 2017 8:36 am
Full Name: Vasiliy.Semendiy
Contact:

Re: Powershell

Post by Vasiliy.Semendiy » Sep 05, 2018 2:35 pm

Thank you.This is exactly what I meant. The command returns two objects. For this reason we get a type conversion error. In this situation you should process each object separately. For example you can write

$user = Get-VBOEntityData -Type User -Repository $repository -Name "<name or part of name with wildcard >"
foreach($u in $user){
Remove-VBOEntityData -Repository $repository -User $u -Mailbox -ArchiveMailbox -OneDrive -Sites -WhatIf
}

This will work with one or more objects.
But make sure that you do not have two users with the same name and different emails when you use filtering by name.

Robvil
Expert
Posts: 129
Liked: 13 times
Joined: Oct 03, 2016 12:41 pm
Full Name: Robert
Contact:

Re: Powershell

Post by Robvil » Sep 06, 2018 6:16 am

Thank yoy, i´ll try.

But why does it original return 2 objects?

Robvil
Expert
Posts: 129
Liked: 13 times
Joined: Oct 03, 2016 12:41 pm
Full Name: Robert
Contact:

Re: Powershell

Post by Robvil » Sep 06, 2018 6:27 am

Running the command with the <-WhatIf> parameter works:

What if: Performing the operation "Remove" on target "Jesper Hagstrøm".
What if: Performing the operation "Remove" on target "Jesper Hagstrøm".

But when removing the -WhatIf parameter throughs an error:

Remove-VBOEntityData : Organization does not exist: 3e7fc064-ab0f-42f4-9cc7-634534098e2e.
At C:\Temp\Delete VBO exchange backup data.ps1:4 char:1
+ Remove-VBOEntityData -Repository $repository -User $u -Mailbox
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-VBOEntityData], FaultException
+ FullyQualifiedErrorId : System.ServiceModel.FaultException,Veeam.Archiver.PowerShell.Cmdlets.BackupItems.RemoveVBOEntityData

Remove-VBOEntityData : Organization does not exist: 3e7fc064-ab0f-42f4-9cc7-634534098e2e.
At C:\Temp\Delete VBO exchange backup data.ps1:4 char:1
+ Remove-VBOEntityData -Repository $repository -User $u -Mailbox
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-VBOEntityData], FaultException
+ FullyQualifiedErrorId : System.ServiceModel.FaultException,Veeam.Archiver.PowerShell.Cmdlets.BackupItems.RemoveVBOEntityData

Vasiliy.Semendiy
Veeam Software
Posts: 4
Liked: never
Joined: Jul 07, 2017 8:36 am
Full Name: Vasiliy.Semendiy
Contact:

Re: Powershell

Post by Vasiliy.Semendiy » Sep 10, 2018 11:21 am

The answer to the first question is most likely in the history of using VBO.
Did you reinstall or upgrade VBO on this server?

Inability to remove a user, when an organization has already been removed - it is a bug. Now i am trying to reproduce it and find a solution.

Robvil
Expert
Posts: 129
Liked: 13 times
Joined: Oct 03, 2016 12:41 pm
Full Name: Robert
Contact:

Re: Powershell

Post by Robvil » Sep 11, 2018 5:27 pm

it´s a upgrade from 1.5. org. has never been removed.

Polina
Veeam Software
Posts: 660
Liked: 98 times
Joined: Oct 21, 2011 11:22 am
Full Name: Polina Vasileva
Contact:

Re: Powershell

Post by Polina » Sep 11, 2018 5:50 pm

Robert,

That's a bit confusing given that previously you shared the following:

Code: Select all

Remove-VBOEntityData : Organization does not exist: 3e7fc064-ab0f-42f4-9cc7-634534098e2e.
I know that there have been probably too many calls with support for you recently, but, again, this would be the most efficient way to investigate the issue.
Let me also note that thanks to your question we found a bug that will now be fixed.

Robvil
Expert
Posts: 129
Liked: 13 times
Joined: Oct 03, 2016 12:41 pm
Full Name: Robert
Contact:

Re: Powershell

Post by Robvil » Sep 12, 2018 11:12 am

Think that message was caused by wrong powershell values by me, maybe ... or not. Can´t remember now... :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests