Maintain control of your Microsoft 365 data
Post Reply
OzFenric
Influencer
Posts: 24
Liked: never
Joined: Feb 20, 2022 11:47 pm
Contact:

Teams identifier for Get- or Remove-VBOEntityData

Post by OzFenric »

Trying to work out what the identifier is for the Remove-VBOEntityData command on Teams. We get a list of Teams with $teams = Get-VBOOrganizationTeam -Organization $org. This gives us a list of teams in the organization's backups. The retrieved data has the fields: OrganizationId; OfficeId; DisplayName; Description; and Mail.
Next we try to use the list of teams to remove any data in the repository. We use a command like: ForEach ($team in $teams) {$teamRemove = Get-VBOEntityData -Type Team -Repository $repository -Team $team.Mail; Remove-VBOEntityData -Team $teamRemove}

This is failing with a bind error. Fails for any of the retrieved data fields.
Cannot bind parameter 'Team'. Cannot convert the [] value of type "System.String" to type "Veeam.Archiver.PowerShell.Model.VBOOrganizationTeam".

Do we need to cast the output for OfficeID to a GUID before passing it to Remove-VBOEntityData? Or is there a different field we should be using?
TIA
Mildur
Product Manager
Posts: 9777
Liked: 2582 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Teams identifier for Get- or Remove-VBOEntityData

Post by Mildur »

Hello OzFenric

Get-VBOOrganizationTeam gives you a list of all Teams in your M365 tenant.
If you want to know which teams you have in your backup repository, you must use Get-VBOEntityData:

Code: Select all

$repo = Get-VBORepository -Name "REPO_Name"
Get-VBOEntityData -Repository $repo -Type Team
I also see the same issues when I'm trying to use your code. I'll check that further in my lab if it works that way.
Is your goal to delete content of every team you have backed up? Then you can maybe use the following code:

Code: Select all

$repo = Get-VBORepository -Name "REPO_Name"
$TeamsInBackup = Get-VBOEntityData -Repository $repo -Type Team
ForEach ($team in $TeamsInBackup) 
    {Remove-VBOEntityData -Repository $repo -Team $team
    }
Best,
Fabian
Product Management Analyst @ Veeam Software
OzFenric
Influencer
Posts: 24
Liked: never
Joined: Feb 20, 2022 11:47 pm
Contact:

Re: Teams identifier for Get- or Remove-VBOEntityData

Post by OzFenric »

We're attempting to remove all Teams data for a specific organisation from a shared repository. The code you've provided is similar to what we've already tried, but Remove-VBOEntityData -Repository $repo -Team $team fails because it can't use the $team variable. What we're looking for here is the property that the -Team parameter will use to identify the team to remove.
Mildur
Product Manager
Posts: 9777
Liked: 2582 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Teams identifier for Get- or Remove-VBOEntityData

Post by Mildur »

Hi OzFenric

You can use a parameter -Organization with Get-VBOEntityData to get only teams from a specific organization in your backup repository and delete them.

Code: Select all

$org = Get-VBOOrganization -Name "ORG_Name"
$repo = Get-VBORepository -Name "REPO_Name"
$TeamsInBackup = Get-VBOEntityData -Repository $repo -Organization $org -Type Team
ForEach ($team in $TeamsInBackup)
	{
	    Remove-VBOEntityData -Repository $repo -Team $team
	}
Best,
Fabian
Product Management Analyst @ Veeam Software
Post Reply

Who is online

Users browsing this forum: AdsBot [Google] and 2 guests