Maintain control of your Microsoft 365 data
Post Reply
mlange
Enthusiast
Posts: 42
Liked: 3 times
Joined: Sep 02, 2014 3:06 pm
Contact:

Remove-VBOLicensedUser not working as expected

Post by mlange »

Here is the code I'm trying to run based off of the help center article.

Code: Select all

$org = Get-VBOOrganization -Id "00000000-0000-0000-0000-000000000000"
$licensedUser = Get-VBOLicensedUser -Organization $org -Name "Test User"
Remove-VBOLicensedUser -User $licensedUser
When I run this I get the error "Remove-VBOLicensedUser : Cannot bind argument to parameter 'User' because it is null." I originally tried using the organization name and was getting the same results. I have confirmed that the user does exist and is still licensed. If I run Get-VBOOrganization with the ID it returns the ID, Name, Type, and IsBackedUp status. If I try to run Get-VBOLicensedUser with the org saved to a variable and the user nothing happens. I'm guessing this is where the hang up is but I'm not sure why.
rajesh.r988
Influencer
Posts: 12
Liked: 2 times
Joined: Mar 06, 2019 5:45 pm
Full Name: RAJESH RADHAKRISHNAN
Contact:

Re: Remove-VBOLicensedUser not working as expected

Post by rajesh.r988 »

Could you please try with Organization Name

Refer - https://helpcenter.veeam.com/docs/vbo36 ... tml?ver=30

$org = Get-VBOOrganization -Name "ORGNAME"
mlange
Enthusiast
Posts: 42
Liked: 3 times
Joined: Sep 02, 2014 3:06 pm
Contact:

Re: Remove-VBOLicensedUser not working as expected

Post by mlange »

As stated in the OP, I have tried with my organization name with the same results.
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Remove-VBOLicensedUser not working as expected

Post by jhoughes »

The issue is not with the organization, it is the username. You need to use the UPN of the user, not the display name for the 'Name' parameter of Get-VBOLicensedUser.

If you're unsure of what it is, you can run your command without the -Name "Test User" to display all users. Copy the username you are trying to specify, then paste that in place of the current username in your example to run your second command again.

Here's a sample from the lab to show this example, with the organization ID shortened to make it slightly more legible:

Code: Select all

PS > Get-VBOOrganization -Id 'b23*'

Id                                   Name                    Type      IsBackedUp
--                                   ----                    ----      ----------
b23* 				     veeamse.onmicrosoft.com Office365 True

PS > $org = Get-VBOOrganization -Id 'b23*'

PS > Get-VBOLicensedUser -Organization $org

UserName                              LastBackupDate       LicenseState OrganizationName
--------                              --------------       ------------ ----------------
VEEAMSE0@veeamse.onmicrosoft.com      4/25/2019 6:02:48 AM Licensed     veeamse.onmicrosoft.com
VEEAMSE1@veeamse.onmicrosoft.com      4/25/2019 6:02:48 AM Licensed     veeamse.onmicrosoft.com
VEEAMSE2@veeamse.onmicrosoft.com      4/25/2019 6:02:48 AM Licensed     veeamse.onmicrosoft.com
VEEAMSE3@veeamse.onmicrosoft.com      4/25/2019 6:02:48 AM Licensed     veeamse.onmicrosoft.com

PS > Get-VBOLicensedUser -Organization $org -Name 'VEEAMSE0@veeamse.onmicrosoft.com'

UserName                         LastBackupDate       LicenseState OrganizationName
--------                         --------------       ------------ ----------------
VEEAMSE0@veeamse.onmicrosoft.com 4/25/2019 6:02:48 AM Licensed     veeamse.onmicrosoft.com


PS > $licensedUser = Get-VBOLicensedUser -Organization $org -Name 'VEEAMSE0@veeamse.onmicrosoft.com'
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
mlange
Enthusiast
Posts: 42
Liked: 3 times
Joined: Sep 02, 2014 3:06 pm
Contact:

Re: Remove-VBOLicensedUser not working as expected

Post by mlange »

Ah, I was going to respond that I'd tried that, but I don't think I'd tried using the UPN with the org ID, just with the org name. Which, I guess while we're on it, what exactly is the org name supposed to be? What's returned when you run Get-VBOOrganization? I feel like the articles for Get-VBOLicensedUser and Get-VBOOrganization are a little ambiguous in what exactly they're expecting for some of the parameters. Get-VBOLicensed user doesn't say anything about using the UPN, it just shows "Fname Lname"
nielsengelen
Product Manager
Posts: 5635
Liked: 1181 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Remove-VBOLicensedUser not working as expected

Post by nielsengelen »

The org name for Get-VBOOrganization is the name of the organization as it is added in the console (or a wildcard). Save this in $org and afterward, you can use it in anything.

The easiest to work is Get-VBOOrganization -Name MYORGANIZATION instead of working with ID's.
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
reto.bucher
Novice
Posts: 3
Liked: never
Joined: May 07, 2019 8:05 am
Contact:

Re: Remove-VBOLicensedUser not working as expected

Post by reto.bucher »

We created a new Domain and deleted a User in the old domain and created it new in the new domain.
Now i have the same Mailbox tweo times in our Backup wich takes an additional license.
Is there any other Parameter to choose the user for deletion? The only thing wich is different with these two users is the OfficeID

Can i run the Remove-VBOLicensedUser with the OfficeID?

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

Re: Remove-VBOLicensedUser not working as expected

Post by Mike Resseler »

Hi Reto,

Can you try something like below: Please note that you might want to try it out first before removing licenses :-). I think that you can use the full email as name (but not sure to be honest)

Code: Select all

$org = Get-VBOOrganization -Name "Organization"
$licensedUser = Get-VBOLicensedUser -Organization $org -Name "JohnSmith@olddomain.com"
Remove-VBOLicensedUser -User $licensedUser
reto.bucher
Novice
Posts: 3
Liked: never
Joined: May 07, 2019 8:05 am
Contact:

Re: Remove-VBOLicensedUser not working as expected

Post by reto.bucher »

Hi Mike,
Thx for the response.
Sadly both the old and new User have the same email adress.. so that won't work.
reto.bucher
Novice
Posts: 3
Liked: never
Joined: May 07, 2019 8:05 am
Contact:

Re: Remove-VBOLicensedUser not working as expected

Post by reto.bucher »

I would still appreciate any help for my problem. it seems i really only can distinguish the old and new User by their OfficeID.
Is it possible to run this code with a filter for the OfficeID??

Code: Select all

$licensedUser = Get-VBOLicensedUser -Organization $org -Name "JohnSmith@olddomain.com"
nielsengelen
Product Manager
Posts: 5635
Liked: 1181 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Remove-VBOLicensedUser not working as expected

Post by nielsengelen »

Reto, this is not directly possible but I would advise you to contact support who may be able to assist you with a workaround.
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests