we have a customer with a large sp/teams environment which we splitted into 47 jobs/repos and 12 proxies. each job contains around 3500 objects.
To achieve this we used a script from veeamhub (vb/jobmanager). It worked and script now runs daily. When new teams/sites are created they are added to a backup job.
But unfortunately deleted sites/teams are not removed from the job and therefore create an error (404 - not found).
How can I remove deleted teams and sites from the backupjobs using powershell?
In the powershell reference I found this:
"
Remove-VBOBackupItemExample 1. Removing Backup Item by Name
This example shows how to remove a Microsoft Exchange or Microsoft SharePoint object from the scope of the TestJob backup job even if this object is no longer available in Microsoft organization.
$job = Get-VBOJob -Name "TestJob"
$item = Get-VBOBackupItem -Job $job -Name "ObjectToRemove"
Remove-VBOBackupItem -Job $job -BackupItem $item
"
https://helpcenter.veeam.com/docs/vbo36 ... tml?ver=70
Well, i tried it but this was not a good idea
Actually, I tested it with one item (a team which had a very long name). It worked fine.
But I have around 10K teams/sites which I want to remove from my 47 jobs. I have a .csv (Identity,DisplayName,Name,ExchangeGuid,Guid) which contains all deleted teams/sites.
So, i created a small script with the example provided in the veeam ps reference:
Code: Select all
$backupItems = Import-Csv -Path "C:\Scripts\deletedsitesteams.csv"
foreach ($itemEntry in $backupItems) {
$itemName = $itemEntry.DisplayName
# Remove backup item from job
$job = Get-VBOJob -Name "SharePointTeams-001"
$item = Get-VBOBackupItem -Job $job -Name $itemName
Remove-VBOBackupItem -Job $job -BackupItem $item}
When script was finished I noticed that were only 10 teams left in job. It should have been around 3200.
What happened? It turned out that "Get-vbobackupitem" can return more than 1 item. Which is very bad. I checked csv and archive.powershell logs and there were many teams with DisplayNames like "BA" or "test".
If you have e.g. 5 teams: test, test1, test2, test3, test4 and want only to remove the team "test" then unfortunately all 5 teams are removed from the job if you do this with Powershell. In my case the string/team DisplayName "BA" removed nearly everything from the job. This was quite a mess.
Does anyone have a solution for this? How can I remove deleted sites/teams from a backupjob automatically?
Any help/hint is appreciated.
Bjoern