Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


511 posts

Ultimate Geek
+1 received by user: 32


Topic # 239429 17-Jul-2018 13:15

Hi Guys,

I am trying PowerShell to see what users have no license for 0365 in the customers tenants.
This is easy enough as I can use:

Get-MsolUser - All

However this gives me also the list of shared mailbox's which doesn't require a license.
I had a look and try to find a way to filter out shared mailbox but can't see a way.

Has anyone done this before or has any tips on how I can do this?

Thanks

Create new topic
633 posts

Ultimate Geek
+1 received by user: 47

Trusted

  Reply # 2057720 17-Jul-2018 13:54
Send private message

Can you work with something like this

 

 

 

Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails SharedMailbox | Get-MsolUser | Where-Object { $_.isLicensed -eq "TRUE" }

 

 

 

SharedMail box, change to User 

 

isLicensed -eq FALSE





The little things make the biggest difference.



511 posts

Ultimate Geek
+1 received by user: 32


  Reply # 2058207 18-Jul-2018 10:29

Thanks yeah I did try that I found the below website which sort of does what I want as well.

https://www.mowasay.com/2016/03/office365-get-a-list-of-shared-mailboxes-that-are-accidentally-licensed/

Sadly i keep getting a error:

Get-MsolUser : The term 'Get-MsolUser' is not recognized as the name of a cmdlet, function, script file or operable program.

38 posts

Geek
+1 received by user: 7


  Reply # 2058321 18-Jul-2018 12:58
Send private message

Oriphix: Thanks yeah I did try that I found the below website which sort of does what I want as well.

https://www.mowasay.com/2016/03/office365-get-a-list-of-shared-mailboxes-that-are-accidentally-licensed/

Sadly i keep getting a error:

Get-MsolUser : The term 'Get-MsolUser' is not recognized as the name of a cmdlet, function, script file or operable program.

 

 

 

Have you used Connect-Msolservice beforehand?

 

Different connection string than what you'd use to connect to Exchange Online. 


357 posts

Ultimate Geek
+1 received by user: 18


  Reply # 2058336 18-Jul-2018 13:43
Send private message

Oriphix: Thanks yeah I did try that I found the below website which sort of does what I want as well.

https://www.mowasay.com/2016/03/office365-get-a-list-of-shared-mailboxes-that-are-accidentally-licensed/

Sadly i keep getting a error:

Get-MsolUser : The term 'Get-MsolUser' is not recognized as the name of a cmdlet, function, script file or operable program.

 

Edit:Should have read the script first.

 

Install Microsoft Exchange Online Powershell Module from the Exchange admin portal, its under Hybrid. (This works with MFA if you have it enabled).

 

Run the link it creates on your desktop. "Microsoft Exchange Online Powershell Module"

 

Connect-EXOPSSession

 

Connect-MsolService

 

Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails SharedMailbox | Get-MsolUser | Where-Object
{ $_.isLicensed -eq "TRUE" }      - Copied from website, change to fit your needs.




511 posts

Ultimate Geek
+1 received by user: 32


  Reply # 2058348 18-Jul-2018 14:19

Thanks for the replies guys still doesn't work.

@plas : I tried to install that exchange module it doesn't install just errors out. This particular account I am not using MFA.
@Jogre : Yes I am see the image below.

After I enter the credentials to login this error comes up straight after.


38 posts

Geek
+1 received by user: 7


  Reply # 2058350 18-Jul-2018 14:23
Send private message

Oriphix: Thanks for the replies guys still doesn't work.

@plas : I tried to install that exchange module it doesn't install just errors out. This particular account I am not using MFA.
@Jogre : Yes I am see the image below.

After I enter the credentials to login this error comes up straight after.

 

Get-Mailbox and Get-Msoluser are different cmdlets. MsolUser will only return information from Office 365 Admin Center, whereas Get-Mailbox will return from Exchange Online Admin Center or On-Prem Exchange.

 

So if you use Connect-MsolService you would only be able to run Get-MsolUser unless you had also auth'd against EAC.


208 posts

Master Geek
+1 received by user: 31


  Reply # 2058358 18-Jul-2018 14:54
Send private message

does this command get a hit;

 

Get-Module -ListAvailable | Where-Object {$_ -match "Get-MsolUser"}

 

If you do not get a hit try;

 

Find-Module -Name Get-MsolUser

 

Unusually for Microsoft product it gives a helpful error message.





Obsequious hypocrite

Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.