Using Powershell, how can I get the UserID of an account if I don't know which domain it is in?
For example, I have a Mail-User account called b.newhart and I can fetch information using that as the -identity with the get-recipient command.
But I need to know the UserID which has the domain name attached to it - for example, [email protected]. This is the UserID that you can see in the Admin panel of Exchange Online.
The reason I need the UserID is so I can use Set-MsolUserPassword on that account. To use this command, I need to specify the -UserPrincipalName which is the UserID. For full o365 accounts (with mail) I can use just the identity, but for Mail-User accounts I need the UserID with the domain name too, not just the identity.
We have very many mail-users from various domains, and the usernames are all standardized first initial + last name. So if I can reset their passwords by just knowing their identity then it would be wonderful.
So, How can I get the the UserID of a Mail-User account? OR how can I reset the password for a Mail-User account without knowing the domain designation?