Maintain control of your Microsoft 365 data
Post Reply
MBCIT
Lurker
Posts: 2
Liked: never
Joined: Apr 05, 2024 1:40 pm
Contact:

Remove-VBOEntityData - Duplicate Names

Post by MBCIT »

Hello,

I am trying to use this script to delete old users out of my "Repository", it work perfectly on any users that appear once in my Repo list.

$repository = Get-VBORepository -Name "NAME OF MY REPO"
$user = Get-VBOEntityData -Type User -Repository $repository -Name "FirstName LastName 1"
Remove-VBOEntityData -Repository $repository -User $user -Confirm:$false


Example: If I browse my backup with the explorer I see

All Stores \
\FirstName Lastname 1 (Good User)
\FirstName Lastname 2 (BAD USER I see duplicated)
\FirstName Lastname 2 (BAD USER I see duplicated)
\FirstName Lastname 2 (BAD USER I see duplicated)
\FirstName Lastname 3 (Good User)

If I try that script on anyone that their name has been duplicated (FirstName LastName 2) it doesn't work. See error below:

Remove-VBOEntityData : Cannot convert 'System.Object[]' to the type
'Veeam.Archiver.PowerShell.Cmdlets.DataManagement.VBOUserData' required by parameter 'User'. Specified method is not
supported.
At line:1 char:52
+ Remove-VBOEntityData -Repository $repository -User $user -Confirm:$fa ...
+ ~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-VBOEntityData], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Veeam.Archiver.PowerShell.Cmdlets.BackupItems.RemoveVBOEntityData

I think these users have been duplicated in Office 365 after a user has left the company and came back. Is there a was to run this command using like a UUID or something?

Thanks for all the help!
Polina
Veeam Software
Posts: 3463
Liked: 830 times
Joined: Oct 21, 2011 11:22 am
Full Name: Polina Vasileva
Contact:

Re: Remove-VBOEntityData - Duplicate Names

Post by Polina »

Hi MBCIT, and welcome to Veeam Forums!

You need to, first, get the required user's ID ID from the organization and then use it to get the same user from the repository:

Code: Select all

$org = Get-VBOOrganization -Name "your org name"
$user = Get-VBOOrganizationUser -Organization $org -OfficeId "user Office ID"
$repository = Get-VBORepository -Name "your repository"
$usertoremove = Get-VBOEntityData -Repository $repository -User $user
Remove-VBOEntityData -Repository $repository -User $usertoremove
MBCIT
Lurker
Posts: 2
Liked: never
Joined: Apr 05, 2024 1:40 pm
Contact:

Re: Remove-VBOEntityData - Duplicate Names

Post by MBCIT »

How do I get list of users out of my Repository -OfficeID ?

I have (2) users with the same name in mt Repository, I just can't figure out how to get the -OfficeId and be able to tell the user with the same name apart.
charmassive
Novice
Posts: 3
Liked: never
Joined: Apr 26, 2024 2:09 am
Full Name: Taylor Duncan
Contact:

Re: Remove-VBOEntityData - Duplicate Names

Post by charmassive »

Polina wrote: Apr 10, 2024 10:59 am Hi MBCIT, and welcome to Veeam Forums!

You need to, first, get the required user's ID ID from the organization and then use it to get the same user from the repositorybasket random:

Code: Select all

$org = Get-VBOOrganization -Name "your org name"
$user = Get-VBOOrganizationUser -Organization $org -OfficeId "user Office ID"
$repository = Get-VBORepository -Name "your repository"
$usertoremove = Get-VBOEntityData -Repository $repository -User $user
Remove-VBOEntityData -Repository $repository -User $usertoremove
Hi Polina
Thank you for your instructions. But I'm a new member and have the same problem. Please explain more clearly how can I get list of users out of my repository?
mjr.epicfail
Veeam Legend
Posts: 488
Liked: 131 times
Joined: Apr 22, 2022 12:14 pm
Full Name: Danny de Heer
Contact:

Re: Remove-VBOEntityData - Duplicate Names

Post by mjr.epicfail »

Hi,

Maybe I can help a little.
I created a powershell script that also enumerates all objects in the repository for the tenant that is specified.
It doesn't help you delete a duplicate from a user (it deletes all) but you can use the first part to enumerate all objects in the repository.
You can find the script here: https://github.com/VeeamHub/powershell/ ... Repository

However I do not see any reference to officeID in the repository.
What you can see is the *BackedUpTime and maybe that can help you identify which object needs to be removed.
VMCE / Veeam Legend 2*
Post Reply

Who is online

Users browsing this forum: No registered users and 45 guests