Maintain control of your Microsoft 365 data
Post Reply
vjalalv
Novice
Posts: 3
Liked: 1 time
Joined: Apr 05, 2022 8:50 am
Full Name: Mohamed Jalal
Contact:

Remove repo data for specific users

Post by vjalalv »

Hi ,

I am newbie in VBO. Please help me to fix the below script which returns error .
Trying to remove data of specific list of users from repository to remove their licenses.

Code: Select all

$repository = Get-VBORepository -Name "Veeam Repo"
$users = Import-Csv -Path C:\scripts\users_bulk.csv 
Foreach ($user in $users)
{
$user = Get-VBOEntityData -Type User -Repository $repository -Name $_.DisplayName
Remove-VBOEntityData -Repository $repository -User $user -Mailbox -ArchiveMailbox -OneDrive -Sites -confirm:$false
}
Thanks
vjalalv

Mike Resseler
Product Manager
Posts: 7592
Liked: 1117 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:

Re: Remove repo data for specific users

Post by Mike Resseler »

Hi vjalalv,

Can you let us know what error you get?

Thanks
Mike

vjalalv
Novice
Posts: 3
Liked: 1 time
Joined: Apr 05, 2022 8:50 am
Full Name: Mohamed Jalal
Contact:

Re: Remove repo data for specific users

Post by vjalalv »

Hi Mike,

Thanks for your response. script returns below error,

Code: Select all

Remove-VBOEntityData : Cannot convert 'System.Object[]' to the type
'Veeam.Archiver.PowerShell.Cmdlets.DataManagement.VBOUserData' required by parameter 'User'. Specified method is not
supported.
At C:\scripts\wipe_repo_data.ps1:6 char:52
+ Remove-VBOEntityData -Repository $repository -User $user -Mailbox -Ar ...
+                                                    ~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Remove-VBOEntityData], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Veeam.Archiver.PowerShell.Cmdlets.BackupItems.RemoveVBOEntityData

Remove-VBOEntityData : Cannot convert 'System.Object[]' to the type
'Veeam.Archiver.PowerShell.Cmdlets.DataManagement.VBOUserData' required by parameter 'User'. Specified method is not
supported.
At C:\scripts\wipe_repo_data.ps1:6 char:52
+ Remove-VBOEntityData -Repository $repository -User $user -Mailbox -Ar ...
+                                                    ~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Remove-VBOEntityData], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Veeam.Archiver.PowerShell.Cmdlets.BackupItems.RemoveVBOEntityData
Thanks
vjalalv

nielsengelen
Veeam Software
Posts: 5058
Liked: 1058 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Remove repo data for specific users

Post by nielsengelen »

Can you provide more details about how your CSV looks like?
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen

jorgedlcruz
Veeam Software
Posts: 829
Liked: 427 times
Joined: Jul 17, 2015 6:54 pm
Full Name: Jorge de la Cruz
Contact:

Re: Remove repo data for specific users

Post by jorgedlcruz »

Hello,
I just tried it on my lab, and your commands look perfect to me, I was struggling for a few minutes as my excel for some reason was exporting a CSV with ; instead of the normal ,

Once figured out that, this worked for me with no issue:

Code: Select all

$repository = Get-VBORepository -Name "REPO-LOCAL-1Y"
$users = Import-Csv -Path C:\scripts\users_bulk.csv
Foreach ($user in $users)
{
$user = Get-VBOEntityData -Type User -Repository $repository -Name $users.DisplayName
Remove-VBOEntityData -Repository $repository -User $user -Mailbox -ArchiveMailbox -OneDrive -Sites -confirm:$false
}
My CSV had just one chap, so the result was this:

Code: Select all

Id                                   JobId                                JobName                       CreationTime
--                                   -----                                -------                       ------------
3b6c599e-8936-4c59-ab19-bf5fccb4c340 2bd5651e-e5e1-4561-a4b5-7b85cf0201f5 Remove user: Jorge de la Cruz 4/20/2022 10...
My CSV looked like this:

Code: Select all

DisplayName,Email
Jorge de la Cruz,jorge.delacruz@jorgedelacruz.es
As Niels asked, please share how does it look like yours, omit real names, or emails, etc.
Jorge de la Cruz
Senior Analyst, Product Management | Veeam ONE @ Veeam Software

@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2022 / InfluxAce

vjalalv
Novice
Posts: 3
Liked: 1 time
Joined: Apr 05, 2022 8:50 am
Full Name: Mohamed Jalal
Contact:

Re: Remove repo data for specific users

Post by vjalalv » 1 person likes this post

My csv had only one column with display names but the header "DisplayName" was not present which caused error.
It worked after I added it.

Thanks @ Niels and @jorgedlcruz .

jorgedlcruz
Veeam Software
Posts: 829
Liked: 427 times
Joined: Jul 17, 2015 6:54 pm
Full Name: Jorge de la Cruz
Contact:

Re: Remove repo data for specific users

Post by jorgedlcruz »

Thank you, Mohamed, for coming back to us. Glad it works now.
Jorge de la Cruz
Senior Analyst, Product Management | Veeam ONE @ Veeam Software

@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2022 / InfluxAce

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests