How can I bulk add guest users with their display names?

0
3
Asked By TechGuru99 On

I'm looking for a way to bulk add guest users while including their display names and email addresses. I also want to do this without sending out any notifications. Any suggestions on how to achieve this?

1 Answer

Answered By CodeMaster123 On

You can easily do this using the Graph module with PowerShell! Just use the **New-MgInvitation** command, which has all the options you need. You’ll want to loop through your list of users that includes their display names and email addresses, and then send out the invites without any notifications. Here's a quick example of how that could look:

```powershell
Foreach($user in $users){
$InviteParams = @{
InvitedUserEmailAddress = $user.UserPrincipalName
InviteRedirectUrl = "https://myapps.microsoft.com"
InvitedUserDisplayName = $user.displayName
SendInvitationMessage = $false
InvitedUserType = "guest"
}
New-MgInvitation -BodyParameter $InviteParams
}
```
This should work for you!

User567 -

Thank you. It worked perfect.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.