Solved

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

Posted on 2014-11-07
2
4,466 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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Read this checklist to learn more about the 15 things you should never include in an email signature.
Microsoft Office Picture Manager has a Picture Shortcuts pane that shows a list with the Recently Browsed folders. While creating my video Micro Tutorial here at Experts Exchange showing How to Install Microsoft Office Picture Manager in Office 2013…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

770 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