You can use the following scripts and bonus tips in any combination if the corresponding component exists in the repository for a specific user. After identifying the user with the appropriate attribute, you can proceed to remove all of their data from the repository. It’s essential to note that this data deletion process will not reduce the database’s size. Instead, data blocks associated with the user will be marked as white space and overwritten in subsequent job runs.
To initiate the process, you should launch PowerShell from within Veeam Backup for Microsoft Office 365. This action will automatically load the necessary toolkit to execute these commands.
Download Script from below
#this is generic script, Please change the following variables according to you need
#this script is created by imtiaz_alum@protechbyte.com
#If you face any issue feel free to write me.
#Uncomment whichever code you want to run
#If you are storing backups of different repository then you need enter correct name of each repository like onedrive is backed up on another repo and mail is on another repo
#Variables that needs to be adjusted:
$origanization_name = "DOMAIN.onmicrosoft.com"
$repository_name = "Default Backup Repository"
#$reporsitory_sharepoint = ""
#$repository_onedrive = ""
$user1 = "USER@DOMAIN.com"
#Standard Script No change required:
$org = Get-VBOOrganization -Name $origanization_name
$repository = Get-VBORepository -Name $repository_name
#Check if data exists:
#$repository = Get-VBORepository -Name $repository_name
#$user = Get-VBOEntityData -Type User -Repository $repository -Name $user1
#echo $user
#Remove Mailbox data:
#$user = Get-VBOEntityData -Type User -Repository $repository -Name $user1
#Remove-VBOEntityData -Repository $repository -User $user -Mailbox -ArchiveMailbox -OneDrive -Sites
#Check Sharepoint Data:
#$Repository = Get-VBORepository -Name $repository_name
#Get-VBOEntityData -Type site -Repository $Repository | sort-object Title
#Remove Sharepoint Data if exists:
#$Repository = Get-VBORepository -Name $repository_name
#$Site = Get-VBOEntityData -Type site -Repository $Repository -name "TITLE"
#Remove-VBOEntityData -Repository $Repository -Site -OneDrive $Site
#Y will accept the deleting of data
#Remove Onedrive Backup files
#$repository = Get-VBORepository -Name $repository_name
#$user = Get-VBOEntityData -Type User -Repository $repository -Name "TITLE"
#Remove-VBOEntityData -Repository $repository -User $user -OneDrive
#Y will accept the deleting of data
#Remove License from Veeam Usage:
#$licensedUser = Get-VBOLicensedUser -Organization $org -Name $user1
#Remove-VBOLicensedUser -User $licensedUser
#Check VBO console to verify the license is removed.