Solved

Office 365--Powershell Script needed to find all users with a certain UPN

Posted on 2014-11-07
2
4,142 Views
Last Modified: 2014-11-07
Powershell Script needed to find all users with a certain UPN ending in @domain.org in my 365 Tenant. What query or filter can i use with Get-MSolUser -All ?

This one doens't work:

  Get-MSoluser -All |? {$_.IsLicensed -match 'False' -and $_.UserPrincipalName -match '*@domain.org'}
0
Comment
Question by:K Anthony O365
2 Comments
 
LVL 13

Accepted Solution

by:
lciprianionut earned 500 total points
ID: 40428482
Did you tried Get-MSoluser -All -DomainName "domain.org" |? {-not $_.IsLicensed}
Also this should work Get-MSoluser -All |? {-not $_.IsLicensed -and $_.UserPrincipalName -like "*@domain.org"}
0
 

Author Closing Comment

by:K Anthony O365
ID: 40428638
Excellent! Worked as expected.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now