Hey, everyone. I have a backup job called TeamsUsers that contains over 1600 individual users being backed up, however, over time, many users are no longer with the organization and their data is no longer available for backup and each one gives a warning of User not Found. Out of the original number of users, only 745 are currently left. I am trying to export the list of users that have the error into a CSV through powershell and then take that csv and have Powershell remove all the users in the csv. I am having mixed results and have tried a powershell script found on an old R&D forum post that almost does the export I need, but it simple outputs all users rather than the ones in the specific job that have the warning. Sadly my scripting knowledge and experience is quite limited and has caused me to spend a couple weeks trying to figure out something that works.
Here is the script I am working with:
Here is a snippet of the output of the CSV it generates with generic user/email/organization name for security:
Any suggestions for the above script as well as one to remove the users that are listed in the output CSV is greatly appreciated.
Here is the script I am working with:
Code:
Import-Module "C:\Program Files\Veeam\Backup365\Veeam.Archiver.PowerShell\Veeam.Archiver.PowerShell.psd1"$reportPath = "C:\Users\<my user>\Desktop\Users.csv"$repos = Get-VBORepository$allUsers = New-Object -TypeName System.Collections.Generic.List[PSCustomObject]foreach ($repository in $repos) { $users = Get-VBOEntityData -Type User -Repository $repository foreach ($user in $users) { $userDetails = [PSCustomObject]@{ DisplayName = $user.DisplayName; Email = $user.Email; AccountType = $user.AccountType; Type = $user.Type; Organization = $user.Organization.DisplayName; "Mailbox Backup" = $user.IsMailboxBackedUp; "Mailbox Backup Time" = $user.MailboxBackedUpTime; "Archive Backup" = $user.IsArchiveBackedUp; "Archive Backup Time" = $user.ArchiveBackedUpTime; "OneDrive Backup" = $user.IsOneDriveBackedUp; "OneDrive Backup Time" = $user.OneDriveBackedUpTime; "Personal Site Backup" = $user.IsPersonalSiteBackedUp; "Personal Site Backup Time" = $user.PersonalSiteBackedUpTime; } $allUsers.Add($userDetails) }}$allUsers | Export-Csv -Path $reportPath -NoTypeInformation
Code:
"DisplayName","Email","AccountType","Type","Organization","Mailbox Backup","Mailbox Backup Time","Archive Backup","Archive Backup Time","OneDrive Backup","OneDrive Backup Time","Personal Site Backup","Personal Site Backup Time""User@organization.net",,"User","User","Organization.onmicrosoft.com","False",,"False",,"True","4/23/2025 10:17:32 AM","True","4/23/2025 10:16:06 AM"
Statistics: Posted by thenodemaster — Apr 23, 2025 5:54 pm