Solved

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

Posted on 2014-11-07
2
3,837 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:kt KTAdmin
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:kt KTAdmin
ID: 40428638
Excellent! Worked as expected.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
If you don't know how to downgrade, my instructions below should be helpful.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

762 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

20 Experts available now in Live!

Get 1:1 Help Now