Maintain control of your Microsoft 365 data
Post Reply
Cia91
Influencer
Posts: 17
Liked: 1 time
Joined: Mar 29, 2017 8:38 am
Contact:

Find user in a repository via Powershell

Post by Cia91 »

Hi, I'm having a problem with some PS script on Veeam for Office 365.

What I'm trying to achieve is to check if some users backup are present on a Repository.

So once i have the Entra username, for example paul.atreides@dune.com i get the user object with:

Code: Select all

$org = Get-VBOOrganization
$user = Get-VBOOrganizationUser -Organization $org -UserName "paul.atreides@dune.com"
If now i print $user i correctly get:

Code: Select all

PS C:\Scripts\VBO> $user

OrganizationId : 00000000-0000-0000-0000-000000000000
OfficeId       : 00000000-0000-0000-0000-000000000000
OnPremisesId   : 00000000-0000-0000-0000-000000000000
DisplayName    : Paul Atreides
UserName       : paul.atreides@dune.com
Type           : User
LocationType   : Office
I then try to search this user in a specific repository in which i know for sure that the user is backed up:

Code: Select all

$repos = Get-VBORepository -Name repo_lr01
Get-VBOEntityData -Repository $repos -User $user
For some user i get the correct output:

Code: Select all

PS C:\Scripts\VBO> Get-VBOEntityData -Repository $repos -User $user

DisplayName   Email              IsMailboxBack IsArchiveBack IsOneDriveBac IsPersonalSit AccountType   Organization
                                 edUp          edUp          kedUp         eBackedUp
-----------   -----              ------------- ------------- ------------- ------------- -----------   ------------
Paul Atre... paul.atreides@du... True          True          False         False         User          
But for some reason other user give me the error:

Code: Select all

PS C:\Scripts\VBO> Get-VBOEntityData -Repository $repos -User $user
Get-VBOEntityData : User not found in the repository (user ID: a1d4e9c-8a19-4c41-f6a6-eda395df4a19:00000000-0000-0000-0000-000000000000, repository ID:
25fcdf35-66d0-43b2-8d28-ea8849020d15).
Parameter name: account
At line:1 char:1
+ Get-VBOEntityData -Repository $repos -User $user
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VBOEntityData], FaultException
    + FullyQualifiedErrorId : System.ServiceModel.FaultException,Veeam.Archiver.PowerShell.Cmdlets.DataManagement.GetVBOEntityData
I'm sure the backup is there because i can find it with the Veeam Explorer, and also if i try to search it with the command
Get-VBOEntityData -Repository $repository -Type User -Name "Paul Atreides" i correctly get it.

What is the command Get-VBOEntityData actually do when i pass to it the user Object i get from Get-VBOOrganizationUser? Is there a way to use it by giving it directly the username? Something like
Get-VBOEntityData -Repository $repository -Type User -Username "paul.atreides@dune.com"

Or maybe there is some other way to check if the user is present on the repository?
mjr.epicfail
Veeam Legend
Posts: 478
Liked: 128 times
Joined: Apr 22, 2022 12:14 pm
Full Name: Danny de Heer
Contact:

Re: Find user in a repository via Powershell

Post by mjr.epicfail »

I think something broke here.

PRE- V8 I would get all users via:

Code: Select all

$OrganizationName = "xxxx.onmicrosoft.com"
$VBMRepository = Get-VBORepository -name "repo1"
Get-VBOEntityData -Type User -Repository $VBMRepository | Where-Object {$_.Organization -like $OrganizationName} 
However this fails now with

Code: Select all

Get-VBOEntityData : Object reference not set to an instance of an object.
At line:176 char:23
+ ... erObjects = Get-VBOEntityData -Type User -Repository $VBMRepository | ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VBOEntityData], FaultException
    + FullyQualifiedErrorId : System.ServiceModel.FaultException,Veeam.Archiver.PowerShell.Cmdlets.DataManagement.GetVBOEntityData
All other "Get-VBOEntityData types" are working.

Maybe the rootcause is the same here.

@PM team, if needed I can create a supportcase for this.
VMCE / Veeam Legend 2*
Cia91
Influencer
Posts: 17
Liked: 1 time
Joined: Mar 29, 2017 8:38 am
Contact:

Re: Find user in a repository via Powershell

Post by Cia91 »

Ok, nice to know. If needed i can also provide logs/data from the real production environment i'm trying to extract the data from.

If i can suggest an improvement it would be nice to get the Get-VBOEntityData command to work also with the username and not only the displayname wich is alway affected by changes.

This way one can bypass entirely the Get-VBOOrganizationUser and go with something like

Code: Select all

Get-VBOEntityData -Repository $repository -Type User -Username "paul.atreides@dune.com"
mjr.epicfail
Veeam Legend
Posts: 478
Liked: 128 times
Joined: Apr 22, 2022 12:14 pm
Full Name: Danny de Heer
Contact:

Re: Find user in a repository via Powershell

Post by mjr.epicfail »

I have only used Get-VBOOrganizationUser to get licensed user and had the need to remove those users from licenses as they are not being backedup anymore.
For deleting such objects (or other object types) within an repository, the get-vboentitydata is the only way.

I created a script for that (veeamhub) but that fails now as well, doublechecked with helpcenter powershell reference and this should still be working.
https://helpcenter.veeam.com/docs/vbo36 ... tml?ver=80

Created a case just in case (pun intended) #07602871
VMCE / Veeam Legend 2*
mjr.epicfail
Veeam Legend
Posts: 478
Liked: 128 times
Joined: Apr 22, 2022 12:14 pm
Full Name: Danny de Heer
Contact:

Re: Find user in a repository via Powershell

Post by mjr.epicfail »

Cia91 wrote: Feb 13, 2025 8:08 am Ok, nice to know. If needed i can also provide logs/data from the real production environment i'm trying to extract the data from.

If i can suggest an improvement it would be nice to get the Get-VBOEntityData command to work also with the username and not only the displayname wich is alway affected by changes.

This way one can bypass entirely the Get-VBOOrganizationUser and go with something like

Code: Select all

Get-VBOEntityData -Repository $repository -Type User -Username "paul.atreides@dune.com"
This works in V8.1:

Code: Select all

Get-VBOEntityData -Repository $repository -Type User -User "paul.atreides@dune.com"
Just tried my first code, and now it works somehow. not sure why. Stil investigating with support
VMCE / Veeam Legend 2*
Cia91
Influencer
Posts: 17
Liked: 1 time
Joined: Mar 29, 2017 8:38 am
Contact:

Re: Find user in a repository via Powershell

Post by Cia91 »

If i run the command like this i get the error:

Code: Select all

PS C:\Users\*******> Get-VBOEntityData -Repository $repos -Type User -User "paul.atreides@dune.com"
Get-VBOEntityData : Cannot bind parameter 'User'. Cannot convert the "paul.atreides@dune.com" value of type "System.String" to type
"Veeam.Archiver.PowerShell.Model.VBOOrganizationUser".
At line:1 char:55
+ ... a -Repository $repos -Type User -User "paul.atreides@dune.com"
+                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-VBOEntityData], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Veeam.Archiver.PowerShell.Cmdlets.DataManagement.GetVBOEntityData
I have to say that i'm on version 7.1, maybe it's time for an upgrade...
mjr.epicfail
Veeam Legend
Posts: 478
Liked: 128 times
Joined: Apr 22, 2022 12:14 pm
Full Name: Danny de Heer
Contact:

Re: Find user in a repository via Powershell

Post by mjr.epicfail »

My apologies,

should be:

Code: Select all

Get-VBOEntityData -Repository $repos -Type User -name "paul.atreides@dune.com"
VMCE / Veeam Legend 2*
Cia91
Influencer
Posts: 17
Liked: 1 time
Joined: Mar 29, 2017 8:38 am
Contact:

Re: Find user in a repository via Powershell

Post by Cia91 »

Ok, i managed to update the infrastructure to the latest version, now the command is working but i get a strange result:

Code: Select all

PS C:\Scripts\VBO> $user = Get-VBOOrganizationUser -Organization $org -UserName "paul.atreides@dune.com"

PS C:\Scripts\VBO> Get-VBOEntityData -Repository $repos2 -User $user


ArchiveName              : In-Place Archive - Paul Atreides
IsMailboxBackedUp        : False
MailboxBackedUpTime      :
IsArchiveBackedUp        : True
ArchiveBackedUpTime      : 3/4/2025 9:03:39 PM
Email                    : paul.atreides@dune.com
IsOneDriveBackedUp       : False
OneDriveBackedUpTime     :
IsPersonalSiteBackedUp   : False
PersonalSiteBackedUpTime :
OneDriveUrl              : {}
PersonalSiteUrl          : {}
Organization             : dune.onmicrosoft.com
AccountType              : User
DisplayName              : In-Place Archive - Paul Atreides
Type                     : User



PS C:\Scripts\VBO> Get-VBOEntityData -Repository $repos2 -Type User -Name "Paul Atreides"


ArchiveName              : In-Place Archive - Paul Atreides
IsMailboxBackedUp        : True
MailboxBackedUpTime      : 3/4/2025 9:07:30 PM
IsArchiveBackedUp        : True
ArchiveBackedUpTime      : 3/4/2025 9:03:39 PM
Email                    : paul.atreides@dune.com
IsOneDriveBackedUp       : False
OneDriveBackedUpTime     :
IsPersonalSiteBackedUp   : False
PersonalSiteBackedUpTime :
OneDriveUrl              : {}
PersonalSiteUrl          : {}
Organization             : dune.onmicrosoft.com
AccountType              : User
DisplayName              : Paul Atreides
Type                     : User
If i run Get-VBOEntityData by passing the User object obtained via the username i get a different result then by running the command by giving the display name.

I have only 1 user with this display name and this user is backed up in a single job, so in this case the command Get-VBOEntityData is finding the same object on the repository, but for some reason for one it doesn't give back the IsMailboxBackedUp : True and the MailboxBackedUpTime.
mjr.epicfail
Veeam Legend
Posts: 478
Liked: 128 times
Joined: Apr 22, 2022 12:14 pm
Full Name: Danny de Heer
Contact:

Re: Find user in a repository via Powershell

Post by mjr.epicfail »

Hi Cia,

I didn't notice this, what version are you on?
VMCE / Veeam Legend 2*
Cia91
Influencer
Posts: 17
Liked: 1 time
Joined: Mar 29, 2017 8:38 am
Contact:

Re: Find user in a repository via Powershell

Post by Cia91 »

8.1.0.3503, updated the other day.
mjr.epicfail
Veeam Legend
Posts: 478
Liked: 128 times
Joined: Apr 22, 2022 12:14 pm
Full Name: Danny de Heer
Contact:

Re: Find user in a repository via Powershell

Post by mjr.epicfail »

Im guessing the first command is showing you if the user exist, not telling / or not supposed to tell you if there are backups
The second command is to really get the backup information for that user.

But I could be mistaken, thats something for R&D / PM to elaborate.
VMCE / Veeam Legend 2*
Post Reply

Who is online

Users browsing this forum: sfey and 317 guests