Forum Discussion
Mark_Babayev
Oct 10, 2023Copper Contributor
Validate Guest/Member users for accounts created before 2014
Old exchange accounts that were created before 2014-2015 don't have userType field. When we query such users their userType returns null: https://graph.microsoft.com/v1.0/users/xxx?$select=createdDa...
LeonPavesic
Oct 11, 2023Silver Contributor
Hi Mark_Babayev,
the solution you can try to validate Guest/Member users for accounts created before 2014 in Microsoft Exchange is:
- Identify all Guest/Member users in your Exchange organization. You can do this by running the following PowerShell command:
Get-Mailbox -ResultSize Unlimited | Where-Object {$_.UserType -eq "GuestMailbox" -or $_.UserType -eq "MemberMailbox"}
This will return a list of all Guest/Member users in your organization.
- For each Guest/Member user, check to see if they have a valid email address. You can do this by running the following PowerShell command:
Test-EmailAddress -EmailAddress $user.PrimarySmtpAddress
If the command returns True, then the email address is valid. If the command returns False, then the email address is not valid.
- If the Guest/Member user has a valid email address, send them an email to validate their account. You can do this using the following PowerShell command:
Send-MailMessage -To $user.PrimarySmtpAddress -Subject "Guest/Member Account Validation" -Body "This email is to validate your Guest/Member account. Please click on the following link to validate your account: [Validation link]"​
The validation link should point to a web page where the user can enter their email address and password to validate their account.
- After the user validates their account, update their UserType property to Guest or Member, depending on their account type. You can do this using the following PowerShell command:
Set-Mailbox -Identity $user.Identity -UserType $user.UserType
Here are some useful links:
- Validate Guest/Member users for accounts created before 2014: https://petri.com/guest-account-obsolete-activity/
- Get-Mailbox: https://learn.microsoft.com/en-us/powershell/module/exchange/get-mailbox?view=exchange-ps
- Where-Object: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/where-object?view=powershell-7.3
- Send-MailMessage: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7.3
- Set-Mailbox: https://lazyadmin.nl/powershell/set-mailbox/
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
- Mark_BabayevMar 27, 2024Copper Contributorhttps://learn.microsoft.com/en-us/powershell/module/exchange/set-mailbox?view=exchange-ps
`Set-Mailbox` doesn't have writable property `UserType`.