-
- Novice
- Posts: 8
- Liked: never
- Joined: Apr 26, 2022 11:13 pm
- Full Name: Joseph
- Contact:
Remove selected user's OneDrive from repository
Case #05387608:
Can someone help me to remove OneDrive data from a thousand users in the repository? I'm trying to achive it using powershell command "ForEach" but unsuccessful. I believe it is simple if I will remove all Onedrive to all users but in my case I have a selected list of users only.
Can someone help me to remove OneDrive data from a thousand users in the repository? I'm trying to achive it using powershell command "ForEach" but unsuccessful. I believe it is simple if I will remove all Onedrive to all users but in my case I have a selected list of users only.
-
- Product Manager
- Posts: 8285
- Liked: 1361 times
- Joined: Feb 08, 2013 3:08 pm
- Full Name: Mike Resseler
- Location: Belgium
- Contact:
Re: Remove selected user's OneDrive from repository
Have a look here for a script: veeam-backup-for-microsoft-365-f47/remo ... 80392.html
-
- Veeam Software
- Posts: 1701
- Liked: 750 times
- Joined: Jul 17, 2015 6:54 pm
- Full Name: Jorge de la Cruz
- Contact:
Re: Remove selected user's OneDrive from repository
Hello Joseph,
As Mike said, I've attached a full script there, mind the part where you can select what to delete from the Users, Mailbox, OneDrive, etc.
Give it a try, and let us know.
As Mike said, I've attached a full script there, mind the part where you can select what to delete from the Users, Mailbox, OneDrive, etc.
Give it a try, and let us know.
Jorge de la Cruz
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
-
- Novice
- Posts: 8
- Liked: never
- Joined: Apr 26, 2022 11:13 pm
- Full Name: Joseph
- Contact:
Re: Remove selected user's OneDrive from repository
Case #05387608
Hi Mike & Jorge,
Thanks in advance for sharing the script.
I tried it but I got an error. Please see below.
Hi Mike & Jorge,
Thanks in advance for sharing the script.
I tried it but I got an error. Please see below.
Code: Select all
++++++++++++++++++++++++++++++++++++++++++++++++++
PS C:\> $repository = Get-VBORepository -Name "S3 Repository"
PS C:\> $users = Import-Csv -Path C:\temp\test.csv
PS C:\> Foreach ($user in $users)
>> {
>> $user = Get-VBOEntityData -Type User -Repository $repository -name $users.DisplayName
>> Remove-VBOEntityData -Repository $repository -User $user -OneDrive -confirm:$false
>> }
Get-VBOEntityData : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'.
Specified method is not supported.
At line:3 char:68
+ ... ntityData -Type User -Repository $repository -name $users.DisplayName
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-VBOEntityData], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Veeam.Archiver.PowerShell.Cmdlets.DataManagement.GetVBOEntityData
Remove-VBOEntityData : Cannot bind parameter 'User'. Cannot convert the "@{DisplayName=Name Lastname;
Email=enail@domain.com}" value of type "System.Management.Automation.PSCustomObject" to type
"Veeam.Archiver.PowerShell.Cmdlets.DataManagement.VBOUserData".
At line:4 char:52
+ Remove-VBOEntityData -Repository $repository -User $user -OneDrive -c ...
+ ~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-VBOEntityData], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Veeam.Archiver.PowerShell.Cmdlets.BackupItems.RemoveVBOEn
tityData
-
- Veeam Software
- Posts: 1701
- Liked: 750 times
- Joined: Jul 17, 2015 6:54 pm
- Full Name: Jorge de la Cruz
- Contact:
Re: Remove selected user's OneDrive from repository
Hello,
I have removed the sensible data from that user you tried.
Would you mind to share with us how does the CSV looks like, please?
I have removed the sensible data from that user you tried.
Would you mind to share with us how does the CSV looks like, please?
Jorge de la Cruz
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
-
- Novice
- Posts: 8
- Liked: never
- Joined: Apr 26, 2022 11:13 pm
- Full Name: Joseph
- Contact:
Re: Remove selected user's OneDrive from repository
Case #05387608
Hi Jorge,
Thanks for removing sensible data..
Here is the contents of my csv file;
++++++
DisplayName
Firstname1 Lastname1
Firstname2 Lastname2
Hi Jorge,
Thanks for removing sensible data..
Here is the contents of my csv file;
++++++
DisplayName
Firstname1 Lastname1
Firstname2 Lastname2
-
- Veeam Software
- Posts: 1701
- Liked: 750 times
- Joined: Jul 17, 2015 6:54 pm
- Full Name: Jorge de la Cruz
- Contact:
Re: Remove selected user's OneDrive from repository
Hello,
Is that if you opened with a notepad?, I can not see the commas, or the expected format shared on the other thread
Could you please try this format?
Thank you
Is that if you opened with a notepad?, I can not see the commas, or the expected format shared on the other thread
Code: Select all
DisplayName,Email
Jorge de la Cruz,jorge.delacruz@jorgedelacruz.es
Thank you
Jorge de la Cruz
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
-
- Novice
- Posts: 8
- Liked: never
- Joined: Apr 26, 2022 11:13 pm
- Full Name: Joseph
- Contact:
Re: Remove selected user's OneDrive from repository
Case #05387608
Hi Jorge,
This is exactly showing if I open it on notepad. I saved the file to a different csv but the result is the same.
+++++++
Hi Jorge,
This is exactly showing if I open it on notepad. I saved the file to a different csv but the result is the same.
+++++++
Code: Select all
DisplayName
User1 Lastname1
User2 Lastname2
-
- Veeam Software
- Posts: 1701
- Liked: 750 times
- Joined: Jul 17, 2015 6:54 pm
- Full Name: Jorge de la Cruz
- Contact:
Re: Remove selected user's OneDrive from repository
Can you please try the powershell commands without anything VB like the import, then write-output, so you see you have all correct, then a write-output inside the for each with the $users.DisplayName as said, no VB commands just normal powershell to see everything else is correct.
I guess the csv is on that c:\temp and all, let us know
I guess the csv is on that c:\temp and all, let us know
Jorge de la Cruz
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
-
- Novice
- Posts: 8
- Liked: never
- Joined: Apr 26, 2022 11:13 pm
- Full Name: Joseph
- Contact:
Re: Remove selected user's OneDrive from repository
It work with this command but using "ForEach" is not working.
+++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++
Code: Select all
$repo = get-vborepository -name "S3 Repository"
$user = get-vboentitydata -type user -repository $repo -name "Firstname Lastname"
remove-vboentitydata -repository $repo -user $user -OneDrive
-
- Novice
- Posts: 8
- Liked: never
- Joined: Apr 26, 2022 11:13 pm
- Full Name: Joseph
- Contact:
Re: Remove selected user's OneDrive from repository
I noticed that the script works if I put only one user on csv file but as soon as I added two or more users, I got that error message.
+++++++++++
+++++++++++
Code: Select all
Get-VBOEntityData : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'.
Specified method is not supported.
At line:3 char:68
+ ... ntityData -Type User -Repository $repository -name $users.DisplayName
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-VBOEntityData], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Veeam.Archiver.PowerShell.Cmdlets.DataManagement.GetVBOEntityData
-
- Veeam Software
- Posts: 1701
- Liked: 750 times
- Joined: Jul 17, 2015 6:54 pm
- Full Name: Jorge de la Cruz
- Contact:
Re: Remove selected user's OneDrive from repository
I am not sure what is wrong, perhaps the CSV, as I can not see it in your previous messages.
Tell me the output of this very simple Script:
My CSV, in case it helps, looks like this, and yes it has commas:
Let us know
Tell me the output of this very simple Script:
Code: Select all
$users = Import-Csv -Path C:\users.csv
Foreach ($user in $users)
{
Write-Output $user.DisplayName
}
Code: Select all
DisplayName,Email
Jorge de la Cruz,jorge.delacruz@jorgedelacruz.es
Second User,anotheremail@jorgedelacruz.es
Third User,anotheremail@domain.es
Jorge de la Cruz
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
-
- Novice
- Posts: 8
- Liked: never
- Joined: Apr 26, 2022 11:13 pm
- Full Name: Joseph
- Contact:
Re: Remove selected user's OneDrive from repository
Please see the result at the bottom;
PS C:\> Foreach ($user in $users)
>> {
>> Write-Output $user.DisplayName
>> }
Jorge de la Cruz
Second User
PS C:\> Foreach ($user in $users)
>> {
>> Write-Output $user.DisplayName
>> }
Jorge de la Cruz
Second User
-
- Novice
- Posts: 8
- Liked: never
- Joined: Apr 26, 2022 11:13 pm
- Full Name: Joseph
- Contact:
Re: Remove selected user's OneDrive from repository
Jorge, I'm not sure if the problem was related to version of VEEAM Backup for Microsoft 365. I have the latest version 6.0.0.367.
-
- Novice
- Posts: 4
- Liked: 1 time
- Joined: Jan 16, 2023 11:12 pm
- Full Name: Cesar Becerra
- Contact:
Re: Remove selected user's OneDrive from repository
Hello,
I have the same problem, the script works just putting a single line in the csv:
DisplayName,Email
Javier Rugeles,jrugeles@mydomain.com
If I add a second user I get an error:
Get-VBOEntityData : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'.
Specified method is not supported.
At line:3 char:68
+ ... ntityData -Type User -Repository $repository -Name $users.DisplayName
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-VBOEntityData], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Veeam.Archiver.PowerShell.Cmdlets.DataManagement.GetVBOEnt
I opened the case with veeam but they tell me that they do not manage custom scripts Case #05823836
I have the same problem, the script works just putting a single line in the csv:
DisplayName,Email
Javier Rugeles,jrugeles@mydomain.com
If I add a second user I get an error:
Get-VBOEntityData : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'.
Specified method is not supported.
At line:3 char:68
+ ... ntityData -Type User -Repository $repository -Name $users.DisplayName
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-VBOEntityData], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Veeam.Archiver.PowerShell.Cmdlets.DataManagement.GetVBOEnt
I opened the case with veeam but they tell me that they do not manage custom scripts Case #05823836
Who is online
Users browsing this forum: No registered users and 6 guests