Skip to main content

I’m trying to delete some user to data to free up licences and it seems to be taking forever to complete. I’m testing with a user who only has a few 100 emails but the command seems to have hung up. Here is the relevant part of the script:

$RepositoryName = 'My_M365Repository'
$UsersToRemove = @(
'Joe.Bloggs@MyDomain.com'
)
$Repository = Get-VBORepository -Name $RepositoryName
foreach($UserToRemove in $UsersToRemove)
{
$UserToRemove
$UserData = Get-VBOEntityData -Type 'User' -Repository $Repository -Name $UserToRemove
if(-not($UserData))
{
'No user data found'
}
Else
{
# Use $UserData to see which backup types exist, and then only remove those.
if($UserData.IsMailboxBackedUp)
{
Write-Host 'Removing Mailbox data'
Remove-VBOEntityData -Repository $Repository -User $UserData -Mailbox -Confirm:$false
}
}
}

Any idea if I’m doing something wrong, or that cmdlet really does just take ages?

 

Thanks.

KW - can I suggest moving this to https://forums.veeam.com/veeam-backup-for-microsoft-365-f47/ as you’re more likely to get a better/faster answer.

 

Cheers, Rob.


oh ok, thanks. Will do.

 

EDIT - I can’t create an account there at the moment, they must be having issues. So, for now, I’ll carry on here.

I’ve had a look in the logs at C:\ProgramData\Veeam\Backup365\Logs\Veeam.Archiver.PowerShell_2023_07_07_12_01_05.log

 

Here is the end of it:

07/07/2023 12:10:49   13 (7600) Processing Veeam PowerShell cmdlet: Get-VBORepository...
07/07/2023 12:10:49 13 (7600) Cmdlet script name: C:\Users\KWCork\Remove-VeeamUserDataAndLicence.ps1 (line number: 12, offset: 15)
07/07/2023 12:10:49 13 (7600) Cmdlet pipeline length: 1 (position: 1)
07/07/2023 12:10:49 13 (7600) Cmdlet parameters:
07/07/2023 12:10:49 13 (7600) Name: My_M365Repository
07/07/2023 12:10:49 13 (7600) Cmdlet execution completed: Get-VBORepository
07/07/2023 12:10:49 13 (7600) Processing Veeam PowerShell cmdlet: Get-VBOEntityData...
07/07/2023 12:10:49 13 (7600) Cmdlet script name: C:\Users\KWCork\Remove-VeeamUserDataAndLicence.ps1 (line number: 16, offset: 17)
07/07/2023 12:10:49 13 (7600) Cmdlet pipeline length: 1 (position: 1)
07/07/2023 12:10:49 13 (7600) Cmdlet parameters:
07/07/2023 12:10:49 13 (7600) Type: User
07/07/2023 12:10:49 13 (7600) Repository: My_M365Repository
07/07/2023 12:10:49 13 (7600) Name: Joe.Bloggs@MyDomain.com
07/07/2023 12:10:49 13 (7600) Cmdlet execution completed: Get-VBOEntityData
07/07/2023 12:10:49 13 (7600) Processing Veeam PowerShell cmdlet: Remove-VBOEntityData...
07/07/2023 12:10:49 13 (7600) Cmdlet script name: C:\Users\KWCork\Remove-VeeamUserDataAndLicence.ps1 (line number: 27, offset: 13)
07/07/2023 12:10:49 13 (7600) Cmdlet pipeline length: 1 (position: 1)
07/07/2023 12:10:49 13 (7600) Cmdlet parameters:
07/07/2023 12:10:49 13 (7600) Repository: My_M365Repository
07/07/2023 12:10:49 13 (7600) User: Veeam.Archiver.PowerShell.Cmdlets.DataManagement.VBOUserData
07/07/2023 12:10:49 13 (7600) Mailbox: True
07/07/2023 12:10:49 13 (7600) Confirm: False

In the Veeam GUI the job has finally finished, but my PowerShell script still shows “Please wait...” and the log file hasn’t updated.


Right, I think that I’ve resolved it. I checked out

“C:\ProgramData\Veeam\Backup365\Logs\Veeam.Archiver.Service_2023_07_07_09_54_54.log”

and, from my guesswork, it seems that the actual deletion happened instantly, but it triggered a full sync of the job. Is that right:


07/07/2023 14:26:12 Deleting job: Remove user: Some User...
07/07/2023 14:26:12 Deleted
07/07/2023 14:26:13 Checking identity of the request from 127...
07/07/2023 14:26:13 Identity check passed
07/07/2023 14:26:13 Adding full synchronization action to queue
07/07/2023 14:26:13 Preparing full synchronization
07/07/2023 14:26:13 Starting proxy configuration synchronization: server

If so, that would be a nightmare to remove 8 users from a job that contains 200.

I returned to the Remove-VBOEntityData cmdlet and see a -RunAsync switch which “Indicates that the command returns immediately without waiting for the task to complete.”. That sounded perfect, so I amended my script, and the jobs ran through immediately.

I don’t know if this change is laying down future issues for me, but I’m happy at the moment. Thanks for the help.


Comment