A
A
Antilogic2013-12-10 09:23:03
PowerShell
Antilogic, 2013-12-10 09:23:03

How to make a request in PowerShell using UPN or EMAIL to get information about a user?

Actually, the question is in the title.
I know that you can Get-ADUser -filter {userprincipalname..
But the bottom line is that there is a list of users where emails and UPn are mixed in a row. It doesn't matter what is slipped from the list, as long as information is given out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alzhir, 2013-12-10
@Antilogic

foreach ($user in get-content C:\Script\upn.txt) {get-aduser -filter *  -properties * | Where-Object {($_.emailaddress -eq $user) -OR ($_.userprincipalname -eq $user)} | select name, userprincipalname, emailaddress}

Not optimal, but it will show the right users.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question